You are here

public function PARSEENTRIES::parseEntry in Bibliography Module 7

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

Grab a complete bibtex entry.

1 call to PARSEENTRIES::parseEntry()
PARSEENTRIES::extractEntries in modules/bibtexParse/PARSEENTRIES.php
This function extract entries taking into account how comments are defined in BibTeX. BibTeX splits the file in two areas: inside an entry and outside an entry, the delimitation being indicated by the presence of a @ sign. When this character is met,…

File

modules/bibtexParse/PARSEENTRIES.php, line 349

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 parseEntry($entry) {

  // Reset the script timer to avoid timeouts.
  set_time_limit(30);
  $entry = $this->translate_latex ? $this
    ->searchReplaceText($this->transtab_latex_unicode, $entry, FALSE) : $entry;
  $count = 0;
  $lastLine = FALSE;
  if (variable_get('biblio_remove_double_bibtex_braces', 0)) {
    $entry = str_replace('{{', '{', $entry);
    $entry = str_replace('}}', '}', $entry);
  }
  if (preg_match("/@(.*)([{(])/U", preg_quote($entry), $matches)) {
    if (!array_key_exists(1, $matches)) {
      return $lastLine;
    }
    if (preg_match("/string/i", trim($matches[1]))) {
      $this->strings[] = $entry;
    }
    elseif (preg_match("/preamble/i", trim($matches[1]))) {
      $this->preamble[] = $entry;
    }
    elseif (preg_match("/comment/i", $matches[1])) {

      // MG (31/Jan/2006) -- ignore @comment
    }
    else {
      if ($this->fieldExtract) {
        $this
          ->fullSplit($entry);
      }
      else {
        $this->entries[$this->count] = $entry;
      }
      $this->count++;
    }
    return $lastLine;
  }
}