Browse Source

changes Scholar citation link

pull/63/merge
Martin Monperrus 9 years ago
parent
commit
b256b7bda5
  1. 11
      bibtexbrowser-test.php
  2. 2
      bibtexbrowser.php

11
bibtexbrowser-test.php

@ -611,6 +611,17 @@ class BTBTest extends PHPUnit_Framework_TestCase {
$this->assertEquals($bibtex, $entry->getText());
}
function testscholarlink() {
bibtexbrowser_configure('BIBTEXBROWSER_BIBTEX_VIEW', 'original');
$bibtex = "@article{key,title={An article Book},gsid={1234},author = {Martin Monperrus and Foo Ac\'e and Monperrus, Martin}}";
$test_data = fopen('php://memory','x+');
fwrite($test_data, $bibtex);
fseek($test_data,0);
$db = new BibDataBase();
$db->update_internal("inline", $test_data);
$entry=$db->getEntryByKey("key");
$this->assertContains('<a href="http://scholar.google.com/scholar?cites=1234">[citations]</a>', $entry->toHTML());
}
} // end class

2
bibtexbrowser.php

@ -1343,7 +1343,7 @@ class BibEntry {
/** GS (Google Scholar) are a special kind of links, where the url depends on the google scholar id */
function getGSLink($iconurl=NULL) {
$str = $this->getIconOrTxt('cites',$iconurl);
$str = $this->getIconOrTxt('citations',$iconurl);
if ($this->hasField('gsid')) {
return ' <a'.get_target().' href="http://scholar.google.com/scholar?cites='.$this->getField("gsid").'">'.$str.'</a>';
}

Loading…
Cancel
Save