fixes bug in generated hyperlinks. Closes #40.
This commit is contained in:
+10
-1
@@ -1662,13 +1662,22 @@ class BibEntry {
|
||||
$entry = htmlspecialchars($this->getFullText());
|
||||
|
||||
// Fields that should be hyperlinks
|
||||
// the order matters
|
||||
$hyperlinks = array('url' => '%O', 'file' => '%O', 'pdf' => '%O', 'doi' => 'http://dx.doi.org/%O', 'gsid' => 'http://scholar.google.com/scholar?cites=%O');
|
||||
|
||||
$vals = array();
|
||||
foreach ($hyperlinks as $field => $url) {
|
||||
if ($this->hasField($field)) {
|
||||
$href = str_replace('%O', $this->getField($field), $url);
|
||||
// this is not a parsing but a simple replacement
|
||||
$entry = str_replace($this->getField($field), '<a'.(BIBTEXBROWSER_LINKS_IN_NEW_WINDOW?' target="_blank" ':'').' href="'.$href.'">'.$this->getField($field).'</a>', $entry);
|
||||
$entry = str_replace($this->getField($field), '___'.$field.'___', $entry);
|
||||
$vals[$field] = $href;
|
||||
}
|
||||
}
|
||||
foreach ($vals as $field => $href) {
|
||||
if ($this->hasField($field)) {
|
||||
// this is not a parsing but a simple replacement
|
||||
$entry = str_replace('___'.$field.'___', '<a'.(BIBTEXBROWSER_LINKS_IN_NEW_WINDOW?' target="_blank" ':'').' href="'.$href.'">'.$this->getField($field).'</a>', $entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user