fix @misc
This commit is contained in:
+16
-5
@@ -98,7 +98,7 @@ class BibtexbrowserTest extends PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
// default style
|
// default style
|
||||||
$this->assertEquals("A Book (Martin Monperrus), Springer, 2009. [bibtex]",strip_tags($first_entry->toHTML()));
|
$this->assertEquals("A Book (Martin Monperrus), Springer, 2009. [bibtex]",strip_tags($first_entry->toHTML()));
|
||||||
$this->assertEquals('<span itemscope="" itemtype="http://schema.org/ScholarlyArticle"><span class="bibtitle" itemprop="name">A Book</span> (<span class="bibauthor"><span itemprop="author" itemtype="http://schema.org/Person">Martin Monperrus</span></span>), <span class="bibpublisher">Springer</span>, <span itemprop="datePublished">2009</span>.<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.btitle=A+Book&rft.genre=book&rft.pub=Springer&rfr_id=info%3Asid%2F%3A&rft.date=2009&rft.au=Martin+Monperrus"></span></span> <span class="bibmenu"><a class="biburl" title="aKey" href="bibtexbrowser.php?key=aKey&bib=inline">[bibtex]</a></span>',$first_entry->toHTML());
|
$this->assertEquals('<span itemscope="" itemtype="http://schema.org/ScholarlyArticle"><span class="bibtitle" itemprop="name">A Book</span> (<span class="bibauthor"><span itemprop="author" itemtype="http://schema.org/Person">Martin Monperrus</span></span>), <span class="bibpublisher">Springer</span>, <span itemprop="datePublished">2009</span>.<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.btitle=A+Book&rft.genre=book&rft.pub=Springer&rfr_id=info%3Asid%2F%3Amybib.bib&rft.date=2009&rft.au=Martin+Monperrus"></span></span> <span class="bibmenu"><a class="biburl" title="aKey" href="bibtexbrowser.php?key=aKey&bib=inline">[bibtex]</a></span>',$first_entry->toHTML());
|
||||||
|
|
||||||
// IEEE style
|
// IEEE style
|
||||||
bibtexbrowser_configure('BIBLIOGRAPHYSTYLE','JanosBibliographyStyle');
|
bibtexbrowser_configure('BIBLIOGRAPHYSTYLE','JanosBibliographyStyle');
|
||||||
@@ -134,7 +134,7 @@ class BibtexbrowserTest extends PHPUnit_Framework_TestCase {
|
|||||||
bibtexbrowser_configure('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');
|
bibtexbrowser_configure('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');
|
||||||
bibtexbrowser_configure('BIBTEXBROWSER_LINK_STYLE','nothing');
|
bibtexbrowser_configure('BIBTEXBROWSER_LINK_STYLE','nothing');
|
||||||
$this->assertEquals("An Article (Foo Bar and Jane Doe), In New Results, volume 5, 2009. ",strip_tags($first_entry->toHTML()));
|
$this->assertEquals("An Article (Foo Bar and Jane Doe), In New Results, volume 5, 2009. ",strip_tags($first_entry->toHTML()));
|
||||||
$this->assertEquals('<span itemscope="" itemtype="http://schema.org/ScholarlyArticle"><span class="bibtitle" itemprop="name">An Article</span> (<span class="bibauthor"><span itemprop="author" itemtype="http://schema.org/Person">Foo Bar</span> and <span itemprop="author" itemtype="http://schema.org/Person">Jane Doe</span></span>), <span class="bibbooktitle">In <span itemprop="isPartOf">New Results</span></span>, volume 5, <span itemprop="datePublished">2009</span>.<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.atitle=An+Article&rft.jtitle=New+Results&rft.volume=5&rft.issue=&rft.pub=&rfr_id=info%3Asid%2F%3A&rft.date=2009&rft.au=Foo+Bar&rft.au=Jane+Doe"></span></span> ',$first_entry->toHTML());
|
$this->assertEquals('<span itemscope="" itemtype="http://schema.org/ScholarlyArticle"><span class="bibtitle" itemprop="name">An Article</span> (<span class="bibauthor"><span itemprop="author" itemtype="http://schema.org/Person">Foo Bar</span> and <span itemprop="author" itemtype="http://schema.org/Person">Jane Doe</span></span>), <span class="bibbooktitle">In <span itemprop="isPartOf">New Results</span></span>, volume 5, <span itemprop="datePublished">2009</span>.<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.atitle=An+Article&rft.jtitle=New+Results&rft.volume=5&rft.issue=&rft.pub=&rfr_id=info%3Asid%2F%3Amybib.bib&rft.date=2009&rft.au=Foo+Bar&rft.au=Jane+Doe"></span></span> ',$first_entry->toHTML());
|
||||||
|
|
||||||
// listing the CSS classes
|
// listing the CSS classes
|
||||||
$css_classes_before = $this->extract_css_classes($first_entry->toHTML());
|
$css_classes_before = $this->extract_css_classes($first_entry->toHTML());
|
||||||
@@ -153,7 +153,7 @@ class BibtexbrowserTest extends PHPUnit_Framework_TestCase {
|
|||||||
// changing the target
|
// changing the target
|
||||||
bibtexbrowser_configure('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');
|
bibtexbrowser_configure('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');
|
||||||
bibtexbrowser_configure('BIBTEXBROWSER_LINKS_TARGET','_top');
|
bibtexbrowser_configure('BIBTEXBROWSER_LINKS_TARGET','_top');
|
||||||
$this->assertEquals('<span itemscope="" itemtype="http://schema.org/ScholarlyArticle"><span class="bibtitle" itemprop="name">An Article</span> (<span class="bibauthor"><span itemprop="author" itemtype="http://schema.org/Person">Foo Bar</span> and <span itemprop="author" itemtype="http://schema.org/Person">Jane Doe</span></span>), <span class="bibbooktitle">In <span itemprop="isPartOf">New Results</span></span>, volume 5, <span itemprop="datePublished">2009</span>.<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.atitle=An+Article&rft.jtitle=New+Results&rft.volume=5&rft.issue=&rft.pub=&rfr_id=info%3Asid%2F%3A&rft.date=2009&rft.au=Foo+Bar&rft.au=Jane+Doe"></span></span> ',$first_entry->toHTML());
|
$this->assertEquals('<span itemscope="" itemtype="http://schema.org/ScholarlyArticle"><span class="bibtitle" itemprop="name">An Article</span> (<span class="bibauthor"><span itemprop="author" itemtype="http://schema.org/Person">Foo Bar</span> and <span itemprop="author" itemtype="http://schema.org/Person">Jane Doe</span></span>), <span class="bibbooktitle">In <span itemprop="isPartOf">New Results</span></span>, volume 5, <span itemprop="datePublished">2009</span>.<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.atitle=An+Article&rft.jtitle=New+Results&rft.volume=5&rft.issue=&rft.pub=&rfr_id=info%3Asid%2F%3Amybib.bib&rft.date=2009&rft.au=Foo+Bar&rft.au=Jane+Doe"></span></span> ',$first_entry->toHTML());
|
||||||
|
|
||||||
// testing ABBRV_TYPE
|
// testing ABBRV_TYPE
|
||||||
bibtexbrowser_configure('ABBRV_TYPE','year');
|
bibtexbrowser_configure('ABBRV_TYPE','year');
|
||||||
@@ -899,10 +899,21 @@ class BibtexbrowserTest extends PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals("may", $data[1]->getField("month"));
|
$this->assertEquals("may", $data[1]->getField("month"));
|
||||||
$this->assertEquals("dec", $data[2]->getField("month"));
|
$this->assertEquals("dec", $data[2]->getField("month"));
|
||||||
|
|
||||||
$bibtex = "@article{doe2004,year=2004},@article{doe1999,year=1999},@article{doe2000,year=2000}";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_misc() {
|
||||||
|
bibtexbrowser_configure('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');
|
||||||
|
$bibtex = "@misc{doe2004,title={foo bar title}, publisher={publisher}, howpublished={howpublished}}";
|
||||||
|
$test_data = fopen('php://memory','x+');
|
||||||
|
fwrite($test_data, $bibtex);
|
||||||
|
fseek($test_data,0);
|
||||||
|
$db = new BibDataBase();
|
||||||
|
$db->update_internal("inline", $test_data);
|
||||||
|
// print_r($db);
|
||||||
|
$data = array_values($db->bibdb);
|
||||||
|
$this->assertEquals('foo bar title, howpublished. [bibtex]', strip_tags($data[0]->toHTML()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // end class
|
} // end class
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -2402,13 +2402,14 @@ function DefaultBibliographyStyle($bibentry) {
|
|||||||
$publisher .= ', '.$bibentry->getField("institution");
|
$publisher .= ', '.$bibentry->getField("institution");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($bibentry->hasField("publisher")) {
|
||||||
|
$publisher = $bibentry->getField("publisher");
|
||||||
|
}
|
||||||
|
|
||||||
if ($type=="misc") {
|
if ($type=="misc") {
|
||||||
$publisher = $bibentry->getField('howpublished');
|
$publisher = $bibentry->getField('howpublished');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bibentry->hasField("publisher")) {
|
|
||||||
$publisher = $bibentry->getField("publisher");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($publisher!='') $entry[] = '<span class="bibpublisher">'.$publisher.'</span>';
|
if ($publisher!='') $entry[] = '<span class="bibpublisher">'.$publisher.'</span>';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user