You are here

public function PARSEENTRIES::fieldSplit in Bibliography Module 7

Same name and namespace in other branches
  1. 5 bibtexParse/PARSEENTRIES.php \PARSEENTRIES::fieldSplit()
  2. 6.2 modules/bibtexParse/PARSEENTRIES.php \PARSEENTRIES::fieldSplit()
  3. 6 bibtexParse/PARSEENTRIES.php \PARSEENTRIES::fieldSplit()
  4. 7.3 plugins/biblio_style/bibtex/PARSEENTRIES.php \PARSEENTRIES::fieldSplit()
  5. 7.2 modules/bibtexParse/PARSEENTRIES.php \PARSEENTRIES::fieldSplit()

Extract a field.

1 call to PARSEENTRIES::fieldSplit()
PARSEENTRIES::reduceFields in modules/bibtexParse/PARSEENTRIES.php
Extract and format fields.

File

modules/bibtexParse/PARSEENTRIES.php, line 251

Class

PARSEENTRIES
// Parse a file $parse = NEW PARSEENTRIES(); $parse->expandMacro = TRUE; // $array = array("RMP" =>"Rev., Mod. Phys."); // $parse->loadStringMacro($array); // $parse->removeDelimit = FALSE; // …

Code

public function fieldSplit($seg) {

  // Echo "**** ";print_r($seg);echo "<BR>";
  // handle fields like another-field = {}.
  $array = preg_split("/,\\s*([-_.:,a-zA-Z0-9]+)\\s*={1}\\s*/U", $seg, PREG_SPLIT_DELIM_CAPTURE);

  // Echo "**** ";print_r($array);echo "<BR>";
  // $array = preg_split("/,\s*(\w+)\s*={1}\s*/U", $seg, PREG_SPLIT_DELIM_CAPTURE);.
  if (!array_key_exists(1, $array)) {
    return array(
      $array[0],
      FALSE,
    );
  }
  return array(
    $array[0],
    $array[1],
  );
}