function render_biblio($input, $parser, $force) { $refs = array(); $keys = array(); $list = $this->expandList($this->split_biblio($input)); $entries = $this->parseBiblio($list); foreach ($entries as $ref) { $key = $ref['key']; $bibtex = $ref['bibtex']; $index = $this->CitationIndex($key, $force); if ($index >= 0) { $text = renderBibtex($bibtex, $index, $parser); $refs[] = array('index' => $index, 'key' => $key, 'text' => $text); $keys[] = $key; } } // remove processed keys from Citations array foreach ($keys as $key) { unset($this->Citations[$key]); } // print error for each unprocessed key foreach ($this->Citations as $key => $index) { $text = $this->errorbox("<strong>Error:</strong> entry with key = " . $key . " does not exist"); $refs[] = array('index' => $index, 'key' => $key, 'text' => $text); } sort($refs); reset($refs); // create errors output $err_msg = ""; foreach ($this->errors as $error) { $err_msg .= $this->errorbox($error); } // create output array from $refs $result = array(); foreach ($refs as $ref) { $index = $ref['index'] + 1; $key = $ref['key']; $text = $ref['text']; $vkey = "<span style=\"color:#aaa\">[{$key}]</span>"; $result[] = "<li id=\"bibkey_{$key}\" value=\"{$index}\"> {$text} \n</li>"; } return $err_msg . '<ol>' . implode("", $result) . '</ol>'; }
function render_biblio($input, $parser, $force, $prefix) { $refs = array(); $keys = array(); $list = $this->expandList($this->split_biblio($input)); $entries = $this->parseBiblio($list); foreach ($entries as $ref) { $key = $ref['key']; $bibtex = $ref['bibtex']; $index = $this->CitationIndex($key, $force, $prefix); if ($index >= 0) { $text = renderBibtex($bibtex, $index, $parser, $prefix); $refs[] = array('index' => $index, 'key' => $key, 'text' => $text); $keys[] = $key; } } // remove processed keys from Citations array foreach ($keys as $key) { unset($this->Citations[$prefix][$key]); } // print error for each unprocessed key foreach ($this->Citations[$prefix] as $key => $index) { $text = $this->errorbox("<strong>Error:</strong> entry with key = " . $key . " does not exist"); $refs[] = array('index' => $index, 'key' => $key, 'text' => $text); } sort($refs); reset($refs); // create errors output $err_msg = ""; foreach ($this->errors as $error) { $err_msg .= $this->errorbox($error); } // create output array from $refs $result = array(); foreach ($refs as $ref) { $index = $ref['index']; $key = $ref['key']; $text = $ref['text']; $vkey = '<span style="color:#aaa">[' . $key . ']</span>'; $result[] = '<li id="bibkey_' . $key . '"' . 'style="list-style:none;padding-left:0.5em;text-indent:-3em;">' . '[' . $prefix . $index . '] ' . $text . '</li>'; } return $err_msg . '<ol>' . implode("", $result) . '</ol>'; }