diff --git a/bibtexbrowser.php b/bibtexbrowser.php index cf03370..05cbff7 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -1622,10 +1622,16 @@ class BibEntry { $result = ""; $result .= '
'; // pre is nice when it is embedded with no CSS available $entry = htmlspecialchars($this->getFullText()); - if ($this->hasField('url')) { - $url = $this->getField('url'); - // this is not a parsing but a simple replacement - $entry = str_replace($url,''.$url.'', $entry); + + // Fields that should be hyperlinks + $hyperlinks = array('url' => '%O', 'file' => '%O', 'pdf' => '%O', 'doi' => 'http://dx.doi.org/%O', 'gsid' => 'http://scholar.google.com/scholar?cites=%O'); + + 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), ''.$this->getField($field).'', $entry); + } } $result .= $entry;