Browse Source

tests PAGE_SIZE

pull/48/head
Martin Monperrus 10 years ago
parent
commit
079b87de90
  1. 222
      bibacid-utf8.bib
  2. 11
      bibtexbrowser-documentation.wiki
  3. 14
      bibtexbrowser-test.php
  4. 14
      bibtexbrowser.php

222
bibacid-utf8.bib

@ -0,0 +1,222 @@
%% test concatenation in @string
@string{foo="Foo"}
@string{bar=foo#" Bar"}
%% test the home page feature
@string{hp_J.Abounader="http://www.google.com"}
@inproceedings{classical,
author = {J. Abounader and D. Tooj},
title = bar,
institution = {Queen's University, Kingston, ON.},
year = {1997}
}
%% testing the abstract
@inproceedings{with_abstract,
author = {J. Abounader and D. Tooj},
title = {This is with abstract},
institution = {Queen's University, Kingston, ON.},
year = {1997},
abstract = {This is an abstract
on several lines}
}
%% using double quotes
%% also Took test the advanced search
@TECHREPORT{dquotes,
author = "J. Abounader and Tooj, D.",
title = "using double quotes ",
institution = "Queen's University, Kingston, ON.",
year = "1997"
}
%% using single value (year)
@TECHREPORT{singlevalue,
author = {The },
title = {The year},
institution = {Queen's University, Kingston, ON.},
year = 1997
}
%% no new line
@TECHREPORT{Abounader1997e, author = {J. Abounader and D. Lamb}, title = "using double quotes", institution = {Queen's University, Kingston, ON.}, year = 1997 }
%% intersting: bibtex does not allow \} in brackets enclosed entries and \" in quotes enclosed entries
%% escaped quotes
@TECHREPORT{notallowed1,
author = {J. Abounader and D. Lamb},
title = "escaped \"quotes\"",
institution = {Queen's University, Kingston, ON.},
year = {1997}
}
%% escaped braces
@TECHREPORT{notallowed2,
author = {J. Abounader \} and D. Lamb},
title = "escaped braces",
institution = {Queen's University, Kingston, ON.},
year = {1997}
}
@article{testsearch1,
author = {Jacob G{\"o}del},
title = {using Banach Space},
year = {1997}
}
@article{testsearch2,
author = {Jacob {G}{\"{o}}del},
title = {using banach space},
year = {1997}
}
@article{testsearch3,
author = {Jacob {G\"{o}del}},
title = {using {Banach} Space},
year = {1997}
}
@article{testsearch4,
author = {Jacob Gödel},
title = {using {B}anach Space},
year = {1997}
}
@article{testsearch5,
author = {Jacob Gödel},
title = {using {Banach Space}},
year = {1997}
}
%% bug from Jakob Kellner
%% copied from ams.org
@article {MR1841330,
AUTHOR = {Lejay, Antoine},
TITLE = {Homogenization of divergence-form operators with lower-order
terms in random media},
JOURNAL = {Probab. Theory Related Fields},
FJOURNAL = {Probability Theory and Related Fields},
VOLUME = {120},
YEAR = {2001},
NUMBER = {2},
PAGES = {255--276},
ISSN = {0178-8051},
CODEN = {PTRFEU},
MRCLASS = {35B27 (31C25 35R60 60H30 60J60)},
MRNUMBER = {MR1841330 (2002g:35023)},
MRREVIEWER = {Jean-Fran{\c{c}}ois Clouet},
DOI = {10.1007/PL00008783},
URL = {http://dx.doi.org/10.1007/PL00008783},
}
@article{serge,
author = "Serge Bug",
title = "curly {braces} in quote",
year = 2010
}
@article{cediltest,
author = "Serge Bug",
title = "\ccurly \c{c}urly {\c{c}}urly ",
year = 2010
}
%%%%% now testing the string concatenation
@string{str1="toto"}
@string{str2="titi"}
@book{stgringconcat:test1,
author = {J. Abounader and D. Lamb},
title = str1#str2,
institution = {Queen's University, Kingston, ON.},
year = {1997}
}
% with space
@bookchapter{stgringconcat:test2,
author = {J. Abounader and D. Lamb},
title = str1 # str2,
institution = {Queen's University, Kingston, ON.},
year = {1997}
}
% with another value
@inbook{stgringconcat:test3,
author = {J. Abounader and D. Lamb},
title = str1 # {3344},
institution = {Queen's University, Kingston, ON.},
year = {1997}
}
%% Saturday, October 09 2010
%% taken from http://en.wikipedia.org/wiki/BibTeX
@PROCEEDINGS {conference:06,
editor = {First Editor and Second Editor},
title = {Proceedings of the Xth Conference on XYZ},
booktitle = {Proceedings of the Xth Conference on XYZ},
year = {2006},
month = oct,
}
@INPROCEEDINGS {author:06,
title = {Some publication title},
author = {First Author and Second Author},
crossref = {conference:06},
pages = {330?331},
}
%% Thursday, October 28 2010
%% two test cases for special key
@INPROCEEDINGS {author+06,
title = {Some publication title},
author = {First Author and Second Author},
year = {2011},
}
@INPROCEEDINGS { author06 ,
title = {Some publication title},
author = {First Author and Second Author},
year = {2011},
}
%% testing the accented i and j
@INPROCEEDINGS {paper000,
title = {Some publication title},
author = {F\`\irst A\`{\i}thor and S{\`\i}cond Author\`\I},
year = {2011},
}
%% bug reported by Mark Hereld
@misc{mark,
title = {Bug in Urls},
author = {Mark Hereld},
howpublished = {\url{http://foo.com/under_score.html}},
year = {2011},
}
%% handling of percentage
@misc{mark,
title = {Percentage \%},
abstract = {Percentage \%},
author = {MM},
year = {2015},
}
% bug https://github.com/monperrus/bibtexbrowser/issues/40
@Article{Baldwin2014Quantum,
Doi = {10.1103/PhysRevA.90.012110},
Url = {http://link.aps.org/doi/10.1103/PhysRevA.90.012110}
}

11
bibtexbrowser-documentation.wiki

@ -414,10 +414,21 @@ class PgmDispatcher extends Dispatcher {
If you want to remove some fields (e.g. abbrv and comment) from the resulting bibtex, add in ''bibtexbrowser.local.php'':
<pre>
&lt;?php
define('BIBTEXBROWSER_BIBTEX_VIEW','reconstructed');
define('BIBTEXBROWSER_BIBTEX_VIEW_FILTEREDOUT','abbrv|comment');
?>
</pre>
====How to activate page numbering in the output?====
Add in ''bibtexbrowser.local.php'':
<pre>
&lt;?php
bibtexbrowser_configure('BIBTEXBROWSER_DEFAULT_DISPLAY','PagedDisplay');
bibtexbrowser_configure('PAGE_SIZE','3');
?>
</pre>
=====Related tools=====

14
bibtexbrowser-test.php

@ -251,6 +251,20 @@ class BTBTest extends PHPUnit_Framework_TestCase {
$this->assertEquals("\`a Book",$dis->getTitle());
}
function test_PagedDisplay() {
$PAGE_SIZE = 3;
bibtexbrowser_configure('BIBTEXBROWSER_DEFAULT_DISPLAY', 'PagedDisplay');
bibtexbrowser_configure('PAGE_SIZE', $PAGE_SIZE);
$_GET['bib'] = 'bibacid-utf8.bib';
$_GET['all'] = 1;
$d = new Dispatcher();
ob_start();
$d->main();
$content = "<div>".ob_get_flush()."</div>";
$xml = new SimpleXMLElement($content);
$result = $xml->xpath('//td[@class=\'bibref\']');
$this->assertEquals($PAGE_SIZE,count($result));
}
} // end class
?>

14
bibtexbrowser.php

@ -2145,7 +2145,7 @@ function DefaultBibliographyStyle(&$bibentry) {
// add the Coin URL
$result .= $bibentry->toCoins();
return '<span itemscope itemtype="http://schema.org/ScholarlyArticle">'.$result.'</span>';
return '<span itemscope="" itemtype="http://schema.org/ScholarlyArticle">'.$result.'</span>';
}
@ -4011,15 +4011,15 @@ class PagedDisplay {
$more = true;
// computing $more
$index = ($this->page)*PAGE_SIZE;
$index = ($this->page)*bibtexbrowser_configuration('PAGE_SIZE');
if (!isset($this->entries[$index])) {
$more = false;
}
$this->menu($less, $more);
print_header_layout();
for ($i = 0; $i < PAGE_SIZE; $i++) {
$index = ($this->page-1)*PAGE_SIZE + $i;
for ($i = 0; $i < bibtexbrowser_configuration('PAGE_SIZE'); $i++) {
$index = ($this->page-1)*bibtexbrowser_configuration('PAGE_SIZE') + $i;
if (isset($this->entries[$index])) {
$bib = $this->entries[$index];
echo $bib->toHTML();
@ -4040,13 +4040,13 @@ class PagedDisplay {
$prev = $this->query;
$prev['page'] = $this->page-1;
if ($less == true) { echo '<a '.makeHref($prev).'">Prev Page</a>'; }
if ($less == true) { echo '<a '.makeHref($prev).'>Prev Page</a>'; }
if ($less && $more) { echo '&nbsp;|&nbsp;'; }
$next = $this->query;
$next['page'] = $this->page+1;
if ($more == true) { echo '<a '.makeHref($next).'">Next Page</a>'; }
if ($more == true) { echo '<a '.makeHref($next).'>Next Page</a>'; }
echo '</span>';
}
@ -4239,7 +4239,7 @@ class Dispatcher {
//echo '<pre>';print_r($selectedEntries);echo '</pre>';
if ($this->displayer=='') {
$this->displayer = BIBTEXBROWSER_DEFAULT_DISPLAY;
$this->displayer = bibtexbrowser_configuration('BIBTEXBROWSER_DEFAULT_DISPLAY');
}
} // otherwise the query is left empty

Loading…
Cancel
Save