From 92fdb641a3b11fb712cffd79fd56ea2f5fe74f8c Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Jan 2018 15:01:38 -0500 Subject: [PATCH 01/14] towards autoloading psr4 --- composer.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composer.json b/composer.json index 84301f5..8c1f270 100644 --- a/composer.json +++ b/composer.json @@ -12,5 +12,10 @@ ], "require": { "php": ">=4" + }, + "autoload": { + "psr-4": { + "Monperrus\\BibtexBrowser\\": "src/" + } } } From 32a9474a23ce97c92bbf0f6927b80c070da9c9f0 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Jan 2018 15:30:45 -0500 Subject: [PATCH 02/14] restructuring hierarchy according to `http://php-pds.com/` --- bibtexbrowser-cli.php => bin/bibtexbrowser-cli.php | 0 bibtexbrowser.php => src/bibtexbrowser.php | 0 bibacid-utf8.bib => tests/bibacid-utf8.bib | 0 bibtexbrowser-test.php => tests/bibtexbrowser-test.php | 0 .../bibtexbrowser-documentation.wiki | 0 bibtexbrowser-users.wiki => wiki/bibtexbrowser-users.wiki | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename bibtexbrowser-cli.php => bin/bibtexbrowser-cli.php (100%) rename bibtexbrowser.php => src/bibtexbrowser.php (100%) rename bibacid-utf8.bib => tests/bibacid-utf8.bib (100%) rename bibtexbrowser-test.php => tests/bibtexbrowser-test.php (100%) rename bibtexbrowser-documentation.wiki => wiki/bibtexbrowser-documentation.wiki (100%) rename bibtexbrowser-users.wiki => wiki/bibtexbrowser-users.wiki (100%) diff --git a/bibtexbrowser-cli.php b/bin/bibtexbrowser-cli.php similarity index 100% rename from bibtexbrowser-cli.php rename to bin/bibtexbrowser-cli.php diff --git a/bibtexbrowser.php b/src/bibtexbrowser.php similarity index 100% rename from bibtexbrowser.php rename to src/bibtexbrowser.php diff --git a/bibacid-utf8.bib b/tests/bibacid-utf8.bib similarity index 100% rename from bibacid-utf8.bib rename to tests/bibacid-utf8.bib diff --git a/bibtexbrowser-test.php b/tests/bibtexbrowser-test.php similarity index 100% rename from bibtexbrowser-test.php rename to tests/bibtexbrowser-test.php diff --git a/bibtexbrowser-documentation.wiki b/wiki/bibtexbrowser-documentation.wiki similarity index 100% rename from bibtexbrowser-documentation.wiki rename to wiki/bibtexbrowser-documentation.wiki diff --git a/bibtexbrowser-users.wiki b/wiki/bibtexbrowser-users.wiki similarity index 100% rename from bibtexbrowser-users.wiki rename to wiki/bibtexbrowser-users.wiki From 28dae0c7026f7a43b5fa986a35c09bb17974375d Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Jan 2018 16:46:07 -0500 Subject: [PATCH 03/14] ok got a basic example working though styling not working --- composer.json | 3 + {tests => public}/bibacid-utf8.bib | 0 ...owser_9dbdd565a8d594a78edbdb704433563b.dat | 134 ++++++++++++++++++ public/index.php | 6 + src/Bibliography.php | 11 ++ 5 files changed, 154 insertions(+) rename {tests => public}/bibacid-utf8.bib (100%) create mode 100644 public/bibtexbrowser_9dbdd565a8d594a78edbdb704433563b.dat create mode 100644 public/index.php create mode 100644 src/Bibliography.php diff --git a/composer.json b/composer.json index 8c1f270..db6b8fe 100644 --- a/composer.json +++ b/composer.json @@ -17,5 +17,8 @@ "psr-4": { "Monperrus\\BibtexBrowser\\": "src/" } + }, + "scripts": { + "server": "@composer -S localhost:9999" } } diff --git a/tests/bibacid-utf8.bib b/public/bibacid-utf8.bib similarity index 100% rename from tests/bibacid-utf8.bib rename to public/bibacid-utf8.bib diff --git a/public/bibtexbrowser_9dbdd565a8d594a78edbdb704433563b.dat b/public/bibtexbrowser_9dbdd565a8d594a78edbdb704433563b.dat new file mode 100644 index 0000000..03a5d12 --- /dev/null +++ b/public/bibtexbrowser_9dbdd565a8d594a78edbdb704433563b.dat @@ -0,0 +1,134 @@ +O:11:"BibDataBase":3:{s:5:"bibdb";a:27:{s:9:"classical";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:13:"inproceedings";s:3:"key";s:9:"classical";s:6:"author";s:24:"J. Abounader and D. Tooj";s:5:"title";s:7:"Foo Bar";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Tooj";}s:10:"raw_fields";a:6:{s:3:"key";s:9:"classical";s:6:"author";s:24:"J. Abounader and D. Tooj";s:5:"title";s:7:"Foo Bar";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Tooj";}s:9:"constants";a:1:{s:3:"bar";s:7:"Foo Bar";}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:150:"@inproceedings{classical, + author = {J. Abounader and D. Tooj}, + title = bar, + institution = {Queen's University, Kingston, ON.}, + year = {1997} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:0;}s:13:"with_abstract";O:8:"BibEntry":11:{s:6:"fields";a:8:{s:13:"x-bibtex-type";s:13:"inproceedings";s:3:"key";s:13:"with_abstract";s:6:"author";s:24:"J. Abounader and D. Tooj";s:5:"title";s:21:"This is with abstract";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:8:"abstract";s:36:"This is an abstract on several lines";s:7:"_author";s:24:"J. Abounader and D. Tooj";}s:10:"raw_fields";a:7:{s:3:"key";s:13:"with_abstract";s:6:"author";s:24:"J. Abounader and D. Tooj";s:5:"title";s:21:"This is with abstract";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:8:"abstract";s:38:"This is an abstract + on several lines";s:7:"_author";s:24:"J. Abounader and D. Tooj";}s:9:"constants";a:0:{}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:229:"@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} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:1;}s:7:"dquotes";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:10:"TECHREPORT";s:3:"key";s:7:"dquotes";s:6:"author";s:25:"J. Abounader and Tooj, D.";s:5:"title";s:19:"using double quotes";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:25:"J. Abounader and Tooj, D.";}s:10:"raw_fields";a:6:{s:3:"key";s:7:"dquotes";s:6:"author";s:25:"J. Abounader and Tooj, D.";s:5:"title";s:20:"using double quotes ";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:25:"J. Abounader and Tooj, D.";}s:9:"constants";a:0:{}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:165:"@TECHREPORT{dquotes, + author = "J. Abounader and Tooj, D.", + title = "using double quotes ", + institution = "Queen's University, Kingston, ON.", + year = "1997" +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:2;}s:11:"singlevalue";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:10:"TECHREPORT";s:3:"key";s:11:"singlevalue";s:6:"author";s:3:"The";s:5:"title";s:8:"The year";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:3:"The";}s:10:"raw_fields";a:6:{s:3:"key";s:11:"singlevalue";s:6:"author";s:4:"The ";s:5:"title";s:8:"The year";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:3:"The";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:134:"@TECHREPORT{singlevalue, + author = {The }, + title = {The year}, + institution = {Queen's University, Kingston, ON.}, + year = 1997 +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:3;}s:14:"Abounader1997e";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:10:"TECHREPORT";s:3:"key";s:14:"Abounader1997e";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:19:"using double quotes";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:14:"Abounader1997e";s:6:"author";s:25:"J. Abounader and D. Lamb";s:5:"title";s:19:"using double quotes";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:9:"constants";a:0:{}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:165:"@TECHREPORT{Abounader1997e, author = {J. Abounader and D. Lamb}, title = "using double quotes", institution = {Queen's University, Kingston, ON.}, year = 1997 }";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:4;}s:11:"notallowed1";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:10:"TECHREPORT";s:3:"key";s:11:"notallowed1";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:18:"escaped \"quotes\"";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:11:"notallowed1";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:18:"escaped \"quotes\"";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:9:"constants";a:0:{}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:166:"@TECHREPORT{notallowed1, + author = {J. Abounader and D. Lamb}, + title = "escaped \"quotes\"", + institution = {Queen's University, Kingston, ON.}, + year = {1997} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:5;}s:11:"notallowed2";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:10:"TECHREPORT";s:3:"key";s:11:"notallowed2";s:6:"author";s:26:"J. Abounader \ and D. Lamb";s:5:"title";s:14:"escaped braces";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:26:"J. Abounader \ and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:11:"notallowed2";s:6:"author";s:27:"J. Abounader \} and D. Lamb";s:5:"title";s:14:"escaped braces";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:26:"J. Abounader \ and D. Lamb";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:165:"@TECHREPORT{notallowed2, + author = {J. Abounader \} and D. Lamb}, + title = "escaped braces", + institution = {Queen's University, Kingston, ON.}, + year = {1997} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:6;}s:11:"testsearch1";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:11:"testsearch1";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:18:"using Banach Space";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:10:"raw_fields";a:5:{s:3:"key";s:11:"testsearch1";s:6:"author";s:15:"Jacob G{\"o}del";s:5:"title";s:18:"using Banach Space";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:101:"@article{testsearch1, + author = {Jacob G{\"o}del}, + title = {using Banach Space}, + year = {1997} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:7;}s:11:"testsearch2";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:11:"testsearch2";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:18:"using banach space";s:4:"year";s:4:"1997";s:7:"_author";s:0:"";}s:10:"raw_fields";a:5:{s:3:"key";s:11:"testsearch2";s:6:"author";s:19:"Jacob {G}{\"{o}}del";s:5:"title";s:18:"using banach space";s:4:"year";s:4:"1997";s:7:"_author";s:0:"";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:105:"@article{testsearch2, + author = {Jacob {G}{\"{o}}del}, + title = {using banach space}, + year = {1997} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:8;}s:11:"testsearch3";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:11:"testsearch3";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:18:"using Banach Space";s:4:"year";s:4:"1997";s:7:"_author";s:0:"";}s:10:"raw_fields";a:5:{s:3:"key";s:11:"testsearch3";s:6:"author";s:17:"Jacob {G\"{o}del}";s:5:"title";s:20:"using {Banach} Space";s:4:"year";s:4:"1997";s:7:"_author";s:0:"";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:105:"@article{testsearch3, + author = {Jacob {G\"{o}del}}, + title = {using {Banach} Space}, + year = {1997} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:9;}s:11:"testsearch4";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:11:"testsearch4";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:18:"using Banach Space";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:10:"raw_fields";a:5:{s:3:"key";s:11:"testsearch4";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:20:"using {B}anach Space";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:100:"@article{testsearch4, + author = {Jacob Gödel}, + title = {using {B}anach Space}, + year = {1997} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:10;}s:11:"testsearch5";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:11:"testsearch5";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:18:"using Banach Space";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:10:"raw_fields";a:5:{s:3:"key";s:11:"testsearch5";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:20:"using {Banach Space}";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:100:"@article{testsearch5, + author = {Jacob Gödel}, + title = {using {Banach Space}}, + year = {1997} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:11;}s:9:"MR1841330";O:8:"BibEntry":11:{s:6:"fields";a:18:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:9:"MR1841330";s:6:"author";s:14:"Lejay, Antoine";s:5:"title";s:82:"Homogenization of divergence-form operators with lower-order terms in random media";s:7:"journal";s:29:"Probab. Theory Related Fields";s:8:"fjournal";s:37:"Probability Theory and Related Fields";s:6:"volume";s:3:"120";s:4:"year";s:4:"2001";s:6:"number";s:1:"2";s:5:"pages";s:9:"255–276";s:4:"issn";s:9:"0178-8051";s:5:"coden";s:6:"PTRFEU";s:7:"mrclass";s:31:"35B27 (31C25 35R60 60H30 60J60)";s:8:"mrnumber";s:23:"MR1841330 (2002g:35023)";s:10:"mrreviewer";s:21:"Jean-François Clouet";s:3:"doi";s:18:"10.1007/PL00008783";s:3:"url";s:36:"http://dx.doi.org/10.1007/PL00008783";s:7:"_author";s:14:"Lejay, Antoine";}s:10:"raw_fields";a:17:{s:3:"key";s:9:"MR1841330";s:6:"author";s:14:"Lejay, Antoine";s:5:"title";s:96:"Homogenization of divergence-form operators with lower-order + terms in random media";s:7:"journal";s:29:"Probab. Theory Related Fields";s:8:"fjournal";s:37:"Probability Theory and Related Fields";s:6:"volume";s:3:"120";s:4:"year";s:4:"2001";s:6:"number";s:1:"2";s:5:"pages";s:8:"255--276";s:4:"issn";s:9:"0178-8051";s:5:"coden";s:6:"PTRFEU";s:7:"mrclass";s:31:"35B27 (31C25 35R60 60H30 60J60)";s:8:"mrnumber";s:23:"MR1841330 (2002g:35023)";s:10:"mrreviewer";s:26:"Jean-Fran{\c{c}}ois Clouet";s:3:"doi";s:18:"10.1007/PL00008783";s:3:"url";s:36:"http://dx.doi.org/10.1007/PL00008783";s:7:"_author";s:14:"Lejay, Antoine";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:618:"@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}, +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:12;}s:5:"serge";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:5:"serge";s:6:"author";s:9:"Serge Bug";s:5:"title";s:21:"curly braces in quote";s:4:"year";s:4:"2010";s:7:"_author";s:9:"Serge Bug";}s:10:"raw_fields";a:5:{s:3:"key";s:5:"serge";s:6:"author";s:9:"Serge Bug";s:5:"title";s:23:"curly {braces} in quote";s:4:"year";s:4:"2010";s:7:"_author";s:9:"Serge Bug";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:92:"@article{serge, + author = "Serge Bug", + title = "curly {braces} in quote", + year = 2010 +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:13;}s:9:"cediltest";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:9:"cediltest";s:6:"author";s:9:"Serge Bug";s:5:"title";s:20:"çurly çurly çurly";s:4:"year";s:4:"2010";s:7:"_author";s:9:"Serge Bug";}s:10:"raw_fields";a:5:{s:3:"key";s:9:"cediltest";s:6:"author";s:9:"Serge Bug";s:5:"title";s:32:"\ccurly \c{c}urly {\c{c}}urly ";s:4:"year";s:4:"2010";s:7:"_author";s:9:"Serge Bug";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:105:"@article{cediltest, + author = "Serge Bug", + title = "\ccurly \c{c}urly {\c{c}}urly ", + year = 2010 +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:14;}s:19:"stgringconcat:test1";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:4:"book";s:3:"key";s:19:"stgringconcat:test1";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"tototiti";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:19:"stgringconcat:test1";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"tototiti";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:9:"constants";a:2:{s:4:"str1";s:4:"toto";s:4:"str2";s:4:"titi";}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:157:"@book{stgringconcat:test1, + author = {J. Abounader and D. Lamb}, + title = str1#str2, + institution = {Queen's University, Kingston, ON.}, + year = {1997} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:15;}s:19:"stgringconcat:test2";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:11:"bookchapter";s:3:"key";s:19:"stgringconcat:test2";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"tototiti";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:19:"stgringconcat:test2";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"tototiti";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:9:"constants";a:2:{s:4:"str1";s:4:"toto";s:4:"str2";s:4:"titi";}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:166:"@bookchapter{stgringconcat:test2, + author = {J. Abounader and D. Lamb}, + title = str1 # str2, + institution = {Queen's University, Kingston, ON.}, + year = {1997} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:16;}s:19:"stgringconcat:test3";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:6:"inbook";s:3:"key";s:19:"stgringconcat:test3";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"toto3344";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:19:"stgringconcat:test3";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"toto3344";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:9:"constants";a:1:{s:4:"str1";s:4:"toto";}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:163:"@inbook{stgringconcat:test3, + author = {J. Abounader and D. Lamb}, + title = str1 # {3344}, + institution = {Queen's University, Kingston, ON.}, + year = {1997} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:17;}s:13:"conference:06";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:11:"PROCEEDINGS";s:3:"key";s:13:"conference:06";s:6:"editor";s:30:"First Editor and Second Editor";s:5:"title";s:40:"Proceedings of the Xth Conference on XYZ";s:9:"booktitle";s:40:"Proceedings of the Xth Conference on XYZ";s:4:"year";s:4:"2006";s:5:"month";s:3:"oct";}s:10:"raw_fields";a:6:{s:3:"key";s:13:"conference:06";s:6:"editor";s:30:"First Editor and Second Editor";s:5:"title";s:40:"Proceedings of the Xth Conference on XYZ";s:9:"booktitle";s:40:"Proceedings of the Xth Conference on XYZ";s:4:"year";s:4:"2006";s:5:"month";s:3:"oct";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:230:"@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, +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:18;}s:9:"author:06";O:8:"BibEntry":11:{s:6:"fields";a:11:{s:13:"x-bibtex-type";s:13:"INPROCEEDINGS";s:3:"key";s:9:"author:06";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:8:"crossref";s:13:"conference:06";s:5:"pages";s:7:"330?331";s:7:"_author";s:30:"First Author and Second Author";s:6:"editor";s:30:"First Editor and Second Editor";s:9:"booktitle";s:40:"Proceedings of the Xth Conference on XYZ";s:4:"year";s:4:"2006";s:5:"month";s:3:"oct";}s:10:"raw_fields";a:10:{s:3:"key";s:9:"author:06";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:8:"crossref";s:13:"conference:06";s:5:"pages";s:7:"330?331";s:7:"_author";s:30:"First Author and Second Author";s:6:"editor";s:30:"First Editor and Second Editor";s:9:"booktitle";s:40:"Proceedings of the Xth Conference on XYZ";s:4:"year";s:4:"2006";s:5:"month";s:3:"oct";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";r:477;s:4:"text";s:164:"@INPROCEEDINGS {author:06, + title = {Some publication title}, + author = {First Author and Second Author}, + crossref = {conference:06}, + pages = {330?331}, +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:19;}s:9:"author+06";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:13:"INPROCEEDINGS";s:3:"key";s:9:"author+06";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:4:"year";s:4:"2011";s:7:"_author";s:30:"First Author and Second Author";}s:10:"raw_fields";a:5:{s:3:"key";s:9:"author+06";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:4:"year";s:4:"2011";s:7:"_author";s:30:"First Author and Second Author";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:128:"@INPROCEEDINGS {author+06, + title = {Some publication title}, + author = {First Author and Second Author}, + year = {2011}, +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:20;}s:8:"author06";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:13:"INPROCEEDINGS";s:3:"key";s:8:"author06";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:4:"year";s:4:"2011";s:7:"_author";s:30:"First Author and Second Author";}s:10:"raw_fields";a:5:{s:3:"key";s:16:" author06 ";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:4:"year";s:4:"2011";s:7:"_author";s:30:"First Author and Second Author";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:135:"@INPROCEEDINGS { author06 , + title = {Some publication title}, + author = {First Author and Second Author}, + year = {2011}, +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:21;}s:8:"paper000";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:13:"INPROCEEDINGS";s:3:"key";s:8:"paper000";s:5:"title";s:22:"Some publication title";s:6:"author";s:35:"Fìrst Aìthor and Sìcond AuthorÌ";s:4:"year";s:4:"2011";s:7:"_author";s:35:"Fìrst Aìthor and Sìcond AuthorÌ";}s:10:"raw_fields";a:5:{s:3:"key";s:8:"paper000";s:5:"title";s:22:"Some publication title";s:6:"author";s:47:"F\`\irst A\`{\i}thor and S{\`\i}cond Author\`\I";s:4:"year";s:4:"2011";s:7:"_author";s:35:"Fìrst Aìthor and Sìcond AuthorÌ";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:144:"@INPROCEEDINGS {paper000, + title = {Some publication title}, + author = {F\`\irst A\`{\i}thor and S{\`\i}cond Author\`\I}, + year = {2011}, +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:22;}s:4:"mark";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:4:"misc";s:3:"key";s:4:"mark";s:5:"title";s:12:"Percentage %";s:8:"abstract";s:12:"Percentage %";s:6:"author";s:2:"MM";s:4:"year";s:4:"2015";s:7:"_author";s:2:"MM";}s:10:"raw_fields";a:6:{s:3:"key";s:4:"mark";s:5:"title";s:13:"Percentage \%";s:8:"abstract";s:13:"Percentage \%";s:6:"author";s:2:"MM";s:4:"year";s:4:"2015";s:7:"_author";s:2:"MM";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:108:"@misc{mark, + title = {Percentage \%}, + abstract = {Percentage \%}, + author = {MM}, + year = {2015}, +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:23;}s:18:"Baldwin2014Quantum";O:8:"BibEntry":11:{s:6:"fields";a:4:{s:13:"x-bibtex-type";s:7:"Article";s:3:"key";s:18:"Baldwin2014Quantum";s:3:"doi";s:26:"10.1103/PhysRevA.90.012110";s:3:"url";s:50:"http://link.aps.org/doi/10.1103/PhysRevA.90.012110";}s:10:"raw_fields";a:3:{s:3:"key";s:18:"Baldwin2014Quantum";s:3:"doi";s:26:"10.1103/PhysRevA.90.012110";s:3:"url";s:50:"http://link.aps.org/doi/10.1103/PhysRevA.90.012110";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:171:"@Article{Baldwin2014Quantum, + Doi = {10.1103/PhysRevA.90.012110}, + Url = {http://link.aps.org/doi/10.1103/PhysRevA.90.012110} +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:24;}s:12:"croatiantest";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:12:"croatiantest";s:6:"author";s:23:"Strabić Strabić";s:5:"title";s:17:"Fancy accents bug";s:4:"year";s:4:"2015";s:7:"_author";s:0:"";}s:10:"raw_fields";a:5:{s:3:"key";s:12:"croatiantest";s:6:"author";s:25:"Strabi{\'{c}} Strabi\'{c}";s:5:"title";s:17:"Fancy accents bug";s:4:"year";s:4:"2015";s:7:"_author";s:0:"";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:109:"@article{croatiantest, + author = "Strabi{\'{c}} Strabi\'{c}", + title = "Fancy accents bug", + year = 2015 +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:25;}s:7:"kjsdf 8";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:7:"kjsdf 8";s:5:"title";s:23:"Entry with + in the key";s:6:"author";s:7:"Foo Bar";s:4:"year";s:4:"2017";s:7:"_author";s:7:"Foo Bar";}s:10:"raw_fields";a:5:{s:3:"key";s:7:"kjsdf 8";s:5:"title";s:23:"Entry with + in the key";s:6:"author";s:7:"Foo Bar";s:4:"year";s:4:"2017";s:7:"_author";s:7:"Foo Bar";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:92:"@article{kjsdf 8, + title = "Entry with + in the key", + author = "Foo Bar", + year = 2017 +}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:26;}}s:8:"stringdb";a:5:{s:3:"foo";O:11:"StringEntry":3:{s:4:"name";s:3:"foo";s:5:"value";s:3:"Foo";s:8:"filename";s:16:"bibacid-utf8.bib";}s:3:"bar";O:11:"StringEntry":3:{s:4:"name";s:3:"bar";s:5:"value";s:7:"Foo Bar";s:8:"filename";s:16:"bibacid-utf8.bib";}s:14:"hp_j.abounader";O:11:"StringEntry":3:{s:4:"name";s:14:"hp_j.abounader";s:5:"value";s:21:"http://www.google.com";s:8:"filename";s:16:"bibacid-utf8.bib";}s:4:"str1";O:11:"StringEntry":3:{s:4:"name";s:4:"str1";s:5:"value";s:4:"toto";s:8:"filename";s:16:"bibacid-utf8.bib";}s:4:"str2";O:11:"StringEntry":3:{s:4:"name";s:4:"str2";s:5:"value";s:4:"titi";s:8:"filename";s:16:"bibacid-utf8.bib";}}s:10:"from_files";a:2:{i:0;s:16:"bibacid-utf8.bib";i:1;s:16:"bibacid-utf8.bib";}} \ No newline at end of file diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..6f4688b --- /dev/null +++ b/public/index.php @@ -0,0 +1,6 @@ + Date: Tue, 30 Jan 2018 16:50:03 -0500 Subject: [PATCH 04/14] bump --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index db6b8fe..8d0c94e 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,6 @@ } }, "scripts": { - "server": "@composer -S localhost:9999" + "serve": "@php -S localhost:8080 -t public/" } } From 82f6ec33bcac3e112f40ebde274a561e025d73f8 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Jan 2018 16:54:00 -0500 Subject: [PATCH 05/14] bump --- .gitignore | 1 + ...owser_9dbdd565a8d594a78edbdb704433563b.dat | 134 ------------------ 2 files changed, 1 insertion(+), 134 deletions(-) create mode 100644 .gitignore delete mode 100644 public/bibtexbrowser_9dbdd565a8d594a78edbdb704433563b.dat diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e4b8799 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.dat \ No newline at end of file diff --git a/public/bibtexbrowser_9dbdd565a8d594a78edbdb704433563b.dat b/public/bibtexbrowser_9dbdd565a8d594a78edbdb704433563b.dat deleted file mode 100644 index 03a5d12..0000000 --- a/public/bibtexbrowser_9dbdd565a8d594a78edbdb704433563b.dat +++ /dev/null @@ -1,134 +0,0 @@ -O:11:"BibDataBase":3:{s:5:"bibdb";a:27:{s:9:"classical";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:13:"inproceedings";s:3:"key";s:9:"classical";s:6:"author";s:24:"J. Abounader and D. Tooj";s:5:"title";s:7:"Foo Bar";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Tooj";}s:10:"raw_fields";a:6:{s:3:"key";s:9:"classical";s:6:"author";s:24:"J. Abounader and D. Tooj";s:5:"title";s:7:"Foo Bar";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Tooj";}s:9:"constants";a:1:{s:3:"bar";s:7:"Foo Bar";}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:150:"@inproceedings{classical, - author = {J. Abounader and D. Tooj}, - title = bar, - institution = {Queen's University, Kingston, ON.}, - year = {1997} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:0;}s:13:"with_abstract";O:8:"BibEntry":11:{s:6:"fields";a:8:{s:13:"x-bibtex-type";s:13:"inproceedings";s:3:"key";s:13:"with_abstract";s:6:"author";s:24:"J. Abounader and D. Tooj";s:5:"title";s:21:"This is with abstract";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:8:"abstract";s:36:"This is an abstract on several lines";s:7:"_author";s:24:"J. Abounader and D. Tooj";}s:10:"raw_fields";a:7:{s:3:"key";s:13:"with_abstract";s:6:"author";s:24:"J. Abounader and D. Tooj";s:5:"title";s:21:"This is with abstract";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:8:"abstract";s:38:"This is an abstract - on several lines";s:7:"_author";s:24:"J. Abounader and D. Tooj";}s:9:"constants";a:0:{}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:229:"@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} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:1;}s:7:"dquotes";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:10:"TECHREPORT";s:3:"key";s:7:"dquotes";s:6:"author";s:25:"J. Abounader and Tooj, D.";s:5:"title";s:19:"using double quotes";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:25:"J. Abounader and Tooj, D.";}s:10:"raw_fields";a:6:{s:3:"key";s:7:"dquotes";s:6:"author";s:25:"J. Abounader and Tooj, D.";s:5:"title";s:20:"using double quotes ";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:25:"J. Abounader and Tooj, D.";}s:9:"constants";a:0:{}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:165:"@TECHREPORT{dquotes, - author = "J. Abounader and Tooj, D.", - title = "using double quotes ", - institution = "Queen's University, Kingston, ON.", - year = "1997" -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:2;}s:11:"singlevalue";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:10:"TECHREPORT";s:3:"key";s:11:"singlevalue";s:6:"author";s:3:"The";s:5:"title";s:8:"The year";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:3:"The";}s:10:"raw_fields";a:6:{s:3:"key";s:11:"singlevalue";s:6:"author";s:4:"The ";s:5:"title";s:8:"The year";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:3:"The";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:134:"@TECHREPORT{singlevalue, - author = {The }, - title = {The year}, - institution = {Queen's University, Kingston, ON.}, - year = 1997 -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:3;}s:14:"Abounader1997e";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:10:"TECHREPORT";s:3:"key";s:14:"Abounader1997e";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:19:"using double quotes";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:14:"Abounader1997e";s:6:"author";s:25:"J. Abounader and D. Lamb";s:5:"title";s:19:"using double quotes";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:9:"constants";a:0:{}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:165:"@TECHREPORT{Abounader1997e, author = {J. Abounader and D. Lamb}, title = "using double quotes", institution = {Queen's University, Kingston, ON.}, year = 1997 }";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:4;}s:11:"notallowed1";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:10:"TECHREPORT";s:3:"key";s:11:"notallowed1";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:18:"escaped \"quotes\"";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:11:"notallowed1";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:18:"escaped \"quotes\"";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:9:"constants";a:0:{}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:166:"@TECHREPORT{notallowed1, - author = {J. Abounader and D. Lamb}, - title = "escaped \"quotes\"", - institution = {Queen's University, Kingston, ON.}, - year = {1997} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:5;}s:11:"notallowed2";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:10:"TECHREPORT";s:3:"key";s:11:"notallowed2";s:6:"author";s:26:"J. Abounader \ and D. Lamb";s:5:"title";s:14:"escaped braces";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:26:"J. Abounader \ and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:11:"notallowed2";s:6:"author";s:27:"J. Abounader \} and D. Lamb";s:5:"title";s:14:"escaped braces";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:26:"J. Abounader \ and D. Lamb";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:165:"@TECHREPORT{notallowed2, - author = {J. Abounader \} and D. Lamb}, - title = "escaped braces", - institution = {Queen's University, Kingston, ON.}, - year = {1997} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:6;}s:11:"testsearch1";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:11:"testsearch1";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:18:"using Banach Space";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:10:"raw_fields";a:5:{s:3:"key";s:11:"testsearch1";s:6:"author";s:15:"Jacob G{\"o}del";s:5:"title";s:18:"using Banach Space";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:101:"@article{testsearch1, - author = {Jacob G{\"o}del}, - title = {using Banach Space}, - year = {1997} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:7;}s:11:"testsearch2";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:11:"testsearch2";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:18:"using banach space";s:4:"year";s:4:"1997";s:7:"_author";s:0:"";}s:10:"raw_fields";a:5:{s:3:"key";s:11:"testsearch2";s:6:"author";s:19:"Jacob {G}{\"{o}}del";s:5:"title";s:18:"using banach space";s:4:"year";s:4:"1997";s:7:"_author";s:0:"";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:105:"@article{testsearch2, - author = {Jacob {G}{\"{o}}del}, - title = {using banach space}, - year = {1997} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:8;}s:11:"testsearch3";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:11:"testsearch3";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:18:"using Banach Space";s:4:"year";s:4:"1997";s:7:"_author";s:0:"";}s:10:"raw_fields";a:5:{s:3:"key";s:11:"testsearch3";s:6:"author";s:17:"Jacob {G\"{o}del}";s:5:"title";s:20:"using {Banach} Space";s:4:"year";s:4:"1997";s:7:"_author";s:0:"";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:105:"@article{testsearch3, - author = {Jacob {G\"{o}del}}, - title = {using {Banach} Space}, - year = {1997} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:9;}s:11:"testsearch4";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:11:"testsearch4";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:18:"using Banach Space";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:10:"raw_fields";a:5:{s:3:"key";s:11:"testsearch4";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:20:"using {B}anach Space";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:100:"@article{testsearch4, - author = {Jacob Gödel}, - title = {using {B}anach Space}, - year = {1997} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:10;}s:11:"testsearch5";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:11:"testsearch5";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:18:"using Banach Space";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:10:"raw_fields";a:5:{s:3:"key";s:11:"testsearch5";s:6:"author";s:12:"Jacob Gödel";s:5:"title";s:20:"using {Banach Space}";s:4:"year";s:4:"1997";s:7:"_author";s:12:"Jacob Gödel";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:100:"@article{testsearch5, - author = {Jacob Gödel}, - title = {using {Banach Space}}, - year = {1997} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:11;}s:9:"MR1841330";O:8:"BibEntry":11:{s:6:"fields";a:18:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:9:"MR1841330";s:6:"author";s:14:"Lejay, Antoine";s:5:"title";s:82:"Homogenization of divergence-form operators with lower-order terms in random media";s:7:"journal";s:29:"Probab. Theory Related Fields";s:8:"fjournal";s:37:"Probability Theory and Related Fields";s:6:"volume";s:3:"120";s:4:"year";s:4:"2001";s:6:"number";s:1:"2";s:5:"pages";s:9:"255–276";s:4:"issn";s:9:"0178-8051";s:5:"coden";s:6:"PTRFEU";s:7:"mrclass";s:31:"35B27 (31C25 35R60 60H30 60J60)";s:8:"mrnumber";s:23:"MR1841330 (2002g:35023)";s:10:"mrreviewer";s:21:"Jean-François Clouet";s:3:"doi";s:18:"10.1007/PL00008783";s:3:"url";s:36:"http://dx.doi.org/10.1007/PL00008783";s:7:"_author";s:14:"Lejay, Antoine";}s:10:"raw_fields";a:17:{s:3:"key";s:9:"MR1841330";s:6:"author";s:14:"Lejay, Antoine";s:5:"title";s:96:"Homogenization of divergence-form operators with lower-order - terms in random media";s:7:"journal";s:29:"Probab. Theory Related Fields";s:8:"fjournal";s:37:"Probability Theory and Related Fields";s:6:"volume";s:3:"120";s:4:"year";s:4:"2001";s:6:"number";s:1:"2";s:5:"pages";s:8:"255--276";s:4:"issn";s:9:"0178-8051";s:5:"coden";s:6:"PTRFEU";s:7:"mrclass";s:31:"35B27 (31C25 35R60 60H30 60J60)";s:8:"mrnumber";s:23:"MR1841330 (2002g:35023)";s:10:"mrreviewer";s:26:"Jean-Fran{\c{c}}ois Clouet";s:3:"doi";s:18:"10.1007/PL00008783";s:3:"url";s:36:"http://dx.doi.org/10.1007/PL00008783";s:7:"_author";s:14:"Lejay, Antoine";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:618:"@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}, -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:12;}s:5:"serge";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:5:"serge";s:6:"author";s:9:"Serge Bug";s:5:"title";s:21:"curly braces in quote";s:4:"year";s:4:"2010";s:7:"_author";s:9:"Serge Bug";}s:10:"raw_fields";a:5:{s:3:"key";s:5:"serge";s:6:"author";s:9:"Serge Bug";s:5:"title";s:23:"curly {braces} in quote";s:4:"year";s:4:"2010";s:7:"_author";s:9:"Serge Bug";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:92:"@article{serge, - author = "Serge Bug", - title = "curly {braces} in quote", - year = 2010 -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:13;}s:9:"cediltest";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:9:"cediltest";s:6:"author";s:9:"Serge Bug";s:5:"title";s:20:"çurly çurly çurly";s:4:"year";s:4:"2010";s:7:"_author";s:9:"Serge Bug";}s:10:"raw_fields";a:5:{s:3:"key";s:9:"cediltest";s:6:"author";s:9:"Serge Bug";s:5:"title";s:32:"\ccurly \c{c}urly {\c{c}}urly ";s:4:"year";s:4:"2010";s:7:"_author";s:9:"Serge Bug";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:105:"@article{cediltest, - author = "Serge Bug", - title = "\ccurly \c{c}urly {\c{c}}urly ", - year = 2010 -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:14;}s:19:"stgringconcat:test1";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:4:"book";s:3:"key";s:19:"stgringconcat:test1";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"tototiti";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:19:"stgringconcat:test1";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"tototiti";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:9:"constants";a:2:{s:4:"str1";s:4:"toto";s:4:"str2";s:4:"titi";}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:157:"@book{stgringconcat:test1, - author = {J. Abounader and D. Lamb}, - title = str1#str2, - institution = {Queen's University, Kingston, ON.}, - year = {1997} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:15;}s:19:"stgringconcat:test2";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:11:"bookchapter";s:3:"key";s:19:"stgringconcat:test2";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"tototiti";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:19:"stgringconcat:test2";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"tototiti";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:9:"constants";a:2:{s:4:"str1";s:4:"toto";s:4:"str2";s:4:"titi";}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:166:"@bookchapter{stgringconcat:test2, - author = {J. Abounader and D. Lamb}, - title = str1 # str2, - institution = {Queen's University, Kingston, ON.}, - year = {1997} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:16;}s:19:"stgringconcat:test3";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:6:"inbook";s:3:"key";s:19:"stgringconcat:test3";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"toto3344";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:10:"raw_fields";a:6:{s:3:"key";s:19:"stgringconcat:test3";s:6:"author";s:24:"J. Abounader and D. Lamb";s:5:"title";s:8:"toto3344";s:11:"institution";s:33:"Queen's University, Kingston, ON.";s:4:"year";s:4:"1997";s:7:"_author";s:24:"J. Abounader and D. Lamb";}s:9:"constants";a:1:{s:4:"str1";s:4:"toto";}s:9:"homepages";a:1:{s:14:"hp_j.abounader";s:21:"http://www.google.com";}s:8:"crossref";N;s:4:"text";s:163:"@inbook{stgringconcat:test3, - author = {J. Abounader and D. Lamb}, - title = str1 # {3344}, - institution = {Queen's University, Kingston, ON.}, - year = {1997} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:17;}s:13:"conference:06";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:11:"PROCEEDINGS";s:3:"key";s:13:"conference:06";s:6:"editor";s:30:"First Editor and Second Editor";s:5:"title";s:40:"Proceedings of the Xth Conference on XYZ";s:9:"booktitle";s:40:"Proceedings of the Xth Conference on XYZ";s:4:"year";s:4:"2006";s:5:"month";s:3:"oct";}s:10:"raw_fields";a:6:{s:3:"key";s:13:"conference:06";s:6:"editor";s:30:"First Editor and Second Editor";s:5:"title";s:40:"Proceedings of the Xth Conference on XYZ";s:9:"booktitle";s:40:"Proceedings of the Xth Conference on XYZ";s:4:"year";s:4:"2006";s:5:"month";s:3:"oct";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:230:"@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, -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:18;}s:9:"author:06";O:8:"BibEntry":11:{s:6:"fields";a:11:{s:13:"x-bibtex-type";s:13:"INPROCEEDINGS";s:3:"key";s:9:"author:06";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:8:"crossref";s:13:"conference:06";s:5:"pages";s:7:"330?331";s:7:"_author";s:30:"First Author and Second Author";s:6:"editor";s:30:"First Editor and Second Editor";s:9:"booktitle";s:40:"Proceedings of the Xth Conference on XYZ";s:4:"year";s:4:"2006";s:5:"month";s:3:"oct";}s:10:"raw_fields";a:10:{s:3:"key";s:9:"author:06";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:8:"crossref";s:13:"conference:06";s:5:"pages";s:7:"330?331";s:7:"_author";s:30:"First Author and Second Author";s:6:"editor";s:30:"First Editor and Second Editor";s:9:"booktitle";s:40:"Proceedings of the Xth Conference on XYZ";s:4:"year";s:4:"2006";s:5:"month";s:3:"oct";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";r:477;s:4:"text";s:164:"@INPROCEEDINGS {author:06, - title = {Some publication title}, - author = {First Author and Second Author}, - crossref = {conference:06}, - pages = {330?331}, -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:19;}s:9:"author+06";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:13:"INPROCEEDINGS";s:3:"key";s:9:"author+06";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:4:"year";s:4:"2011";s:7:"_author";s:30:"First Author and Second Author";}s:10:"raw_fields";a:5:{s:3:"key";s:9:"author+06";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:4:"year";s:4:"2011";s:7:"_author";s:30:"First Author and Second Author";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:128:"@INPROCEEDINGS {author+06, - title = {Some publication title}, - author = {First Author and Second Author}, - year = {2011}, -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:20;}s:8:"author06";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:13:"INPROCEEDINGS";s:3:"key";s:8:"author06";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:4:"year";s:4:"2011";s:7:"_author";s:30:"First Author and Second Author";}s:10:"raw_fields";a:5:{s:3:"key";s:16:" author06 ";s:5:"title";s:22:"Some publication title";s:6:"author";s:30:"First Author and Second Author";s:4:"year";s:4:"2011";s:7:"_author";s:30:"First Author and Second Author";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:135:"@INPROCEEDINGS { author06 , - title = {Some publication title}, - author = {First Author and Second Author}, - year = {2011}, -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:21;}s:8:"paper000";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:13:"INPROCEEDINGS";s:3:"key";s:8:"paper000";s:5:"title";s:22:"Some publication title";s:6:"author";s:35:"Fìrst Aìthor and Sìcond AuthorÌ";s:4:"year";s:4:"2011";s:7:"_author";s:35:"Fìrst Aìthor and Sìcond AuthorÌ";}s:10:"raw_fields";a:5:{s:3:"key";s:8:"paper000";s:5:"title";s:22:"Some publication title";s:6:"author";s:47:"F\`\irst A\`{\i}thor and S{\`\i}cond Author\`\I";s:4:"year";s:4:"2011";s:7:"_author";s:35:"Fìrst Aìthor and Sìcond AuthorÌ";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:144:"@INPROCEEDINGS {paper000, - title = {Some publication title}, - author = {F\`\irst A\`{\i}thor and S{\`\i}cond Author\`\I}, - year = {2011}, -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:22;}s:4:"mark";O:8:"BibEntry":11:{s:6:"fields";a:7:{s:13:"x-bibtex-type";s:4:"misc";s:3:"key";s:4:"mark";s:5:"title";s:12:"Percentage %";s:8:"abstract";s:12:"Percentage %";s:6:"author";s:2:"MM";s:4:"year";s:4:"2015";s:7:"_author";s:2:"MM";}s:10:"raw_fields";a:6:{s:3:"key";s:4:"mark";s:5:"title";s:13:"Percentage \%";s:8:"abstract";s:13:"Percentage \%";s:6:"author";s:2:"MM";s:4:"year";s:4:"2015";s:7:"_author";s:2:"MM";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:108:"@misc{mark, - title = {Percentage \%}, - abstract = {Percentage \%}, - author = {MM}, - year = {2015}, -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:23;}s:18:"Baldwin2014Quantum";O:8:"BibEntry":11:{s:6:"fields";a:4:{s:13:"x-bibtex-type";s:7:"Article";s:3:"key";s:18:"Baldwin2014Quantum";s:3:"doi";s:26:"10.1103/PhysRevA.90.012110";s:3:"url";s:50:"http://link.aps.org/doi/10.1103/PhysRevA.90.012110";}s:10:"raw_fields";a:3:{s:3:"key";s:18:"Baldwin2014Quantum";s:3:"doi";s:26:"10.1103/PhysRevA.90.012110";s:3:"url";s:50:"http://link.aps.org/doi/10.1103/PhysRevA.90.012110";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:171:"@Article{Baldwin2014Quantum, - Doi = {10.1103/PhysRevA.90.012110}, - Url = {http://link.aps.org/doi/10.1103/PhysRevA.90.012110} -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:24;}s:12:"croatiantest";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:12:"croatiantest";s:6:"author";s:23:"Strabić Strabić";s:5:"title";s:17:"Fancy accents bug";s:4:"year";s:4:"2015";s:7:"_author";s:0:"";}s:10:"raw_fields";a:5:{s:3:"key";s:12:"croatiantest";s:6:"author";s:25:"Strabi{\'{c}} Strabi\'{c}";s:5:"title";s:17:"Fancy accents bug";s:4:"year";s:4:"2015";s:7:"_author";s:0:"";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:109:"@article{croatiantest, - author = "Strabi{\'{c}} Strabi\'{c}", - title = "Fancy accents bug", - year = 2015 -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:25;}s:7:"kjsdf 8";O:8:"BibEntry":11:{s:6:"fields";a:6:{s:13:"x-bibtex-type";s:7:"article";s:3:"key";s:7:"kjsdf 8";s:5:"title";s:23:"Entry with + in the key";s:6:"author";s:7:"Foo Bar";s:4:"year";s:4:"2017";s:7:"_author";s:7:"Foo Bar";}s:10:"raw_fields";a:5:{s:3:"key";s:7:"kjsdf 8";s:5:"title";s:23:"Entry with + in the key";s:6:"author";s:7:"Foo Bar";s:4:"year";s:4:"2017";s:7:"_author";s:7:"Foo Bar";}s:9:"constants";a:0:{}s:9:"homepages";a:0:{}s:8:"crossref";N;s:4:"text";s:92:"@article{kjsdf 8, - title = "Entry with + in the key", - author = "Foo Bar", - year = 2017 -}";s:9:"timestamp";i:1517348418;s:8:"filename";s:16:"bibacid-utf8.bib";s:5:"abbrv";N;s:5:"index";s:0:"";s:5:"order";i:26;}}s:8:"stringdb";a:5:{s:3:"foo";O:11:"StringEntry":3:{s:4:"name";s:3:"foo";s:5:"value";s:3:"Foo";s:8:"filename";s:16:"bibacid-utf8.bib";}s:3:"bar";O:11:"StringEntry":3:{s:4:"name";s:3:"bar";s:5:"value";s:7:"Foo Bar";s:8:"filename";s:16:"bibacid-utf8.bib";}s:14:"hp_j.abounader";O:11:"StringEntry":3:{s:4:"name";s:14:"hp_j.abounader";s:5:"value";s:21:"http://www.google.com";s:8:"filename";s:16:"bibacid-utf8.bib";}s:4:"str1";O:11:"StringEntry":3:{s:4:"name";s:4:"str1";s:5:"value";s:4:"toto";s:8:"filename";s:16:"bibacid-utf8.bib";}s:4:"str2";O:11:"StringEntry":3:{s:4:"name";s:4:"str2";s:5:"value";s:4:"titi";s:8:"filename";s:16:"bibacid-utf8.bib";}}s:10:"from_files";a:2:{i:0;s:16:"bibacid-utf8.bib";i:1;s:16:"bibacid-utf8.bib";}} \ No newline at end of file From f99a476feabb41444cc1c6806b44ff9d7a5107e9 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Jan 2018 19:14:19 -0500 Subject: [PATCH 06/14] working on example and separation of stuff --- public/bibtexbrowser.css | 28 ++++++ public/index.php | 12 ++- src/Bibliography.php | 22 ++++- src/Definitions.php | 188 +++++++++++++++++++++++++++++++++++++++ src/bibtexbrowser.php | 188 +-------------------------------------- 5 files changed, 249 insertions(+), 189 deletions(-) create mode 100644 public/bibtexbrowser.css create mode 100644 src/Definitions.php diff --git a/public/bibtexbrowser.css b/public/bibtexbrowser.css new file mode 100644 index 0000000..f286b92 --- /dev/null +++ b/public/bibtexbrowser.css @@ -0,0 +1,28 @@ +.datePublished { + background-color: blue; +} +.btb-header { } +.rheader { + font-size: large +} +.sheader { + padding-top: 10px; +} +.bibref { + /*padding:3px; */ +/* padding-left:15px; */ + vertical-align:top; + color:white;} +/*.bibtitle { font-weight:bold; }*/ +.bibitem { + text-indent:-35px; + padding-left:35px; +} +.bibbooktitle { font-style:italic; } +.count { color:gray } +.sheader { font-weight:bold; font-size: large;} +.volume { font-style: italic; } + +body { + background:green; +} diff --git a/public/index.php b/public/index.php index 6f4688b..c878444 100644 --- a/public/index.php +++ b/public/index.php @@ -1,6 +1,12 @@ "bibacid-utf8.bib", + "all" => 1, + "author" => "", + "academic" => 1 +); + +$browser = new Monperrus\BibtexBrowser\Bibliography($config); +$browser->print(); diff --git a/src/Bibliography.php b/src/Bibliography.php index c907893..00e4ede 100644 --- a/src/Bibliography.php +++ b/src/Bibliography.php @@ -2,9 +2,29 @@ namespace Monperrus\BibtexBrowser; +use Monperrus\BibtexBrowser\Definitions; + class Bibliography { - public function __construct() + private $defaultConfig = array("bib" => null, + "all" => null, + "author" => null, + "library" => null, + "academic" => null); + + private $config = array(); + + public function __construct($userConfig = array()) + { + // (PHP 5 >= 5.3.0, PHP 7) + $this->config = array_replace($this->defaultConfig, $userConfig); + + if (!isset($_GET['bib'])) { + $_GET['bib'] = $this->config['bib']; + } + } + + public function print() { require_once "bibtexbrowser.php"; } diff --git a/src/Definitions.php b/src/Definitions.php new file mode 100644 index 0000000..89a3394 --- /dev/null +++ b/src/Definitions.php @@ -0,0 +1,188 @@ + 0 if str1 is greater than str2, and 0 if they are equal. +// can be @define('ORDER_FUNCTION','compare_bib_entry_by_title'); +// can be @define('ORDER_FUNCTION','compare_bib_entry_by_bibtex_order'); +@define('ORDER_FUNCTION','compare_bib_entry_by_year'); +@define('ORDER_FUNCTION_FINE','compare_bib_entry_by_month'); + +// only displaying the n newest entries +@define('BIBTEXBROWSER_NEWEST',5); + +@define('BIBTEXBROWSER_NO_DEFAULT', false); + +// BIBTEXBROWSER_LINK_STYLE defines which function to use to display the links of a bibtex entry +@define('BIBTEXBROWSER_LINK_STYLE','bib2links_default'); // can be 'nothing' (a function that does nothing) + +// do we add [bibtex] links ? +@define('BIBTEXBROWSER_BIBTEX_LINKS',true); +// do we add [pdf] links ? +@define('BIBTEXBROWSER_PDF_LINKS',true); +// do we add [doi] links ? +@define('BIBTEXBROWSER_DOI_LINKS',true); +// do we add [gsid] links (Google Scholar)? +@define('BIBTEXBROWSER_GSID_LINKS',true); + +// should pdf, doi, url, gsid links be opened in a new window? +@define('BIBTEXBROWSER_LINKS_TARGET','_self');// can be _blank (new window), _top (with frames) + +// should authors be linked to [none/homepage/resultpage] +// none: nothing +// their homepage if defined as @strings +// their publication lists according to this bibtex +@define('BIBTEXBROWSER_AUTHOR_LINKS','homepage'); + +// BIBTEXBROWSER_LAYOUT defines the HTML rendering layout of the produced HTML +// may be table/list/ordered_list/definition/none (for ,
    ,
    , nothing resp.). +// for list/ordered_list, the abbrevations are not taken into account (see ABBRV_TYPE) +// for ordered_list, the index is given by HTML directly (in increasing order) +@define('BIBTEXBROWSER_LAYOUT','table'); + +// should the original bibtex be displayed or a reconstructed one with filtering +// values: original/reconstructed +// warning, with reconstructed, the latex markup for accents/diacritics is lost +@define('BIBTEXBROWSER_BIBTEX_VIEW','original'); +// a list of fields that will not be shown in the bibtex view if BIBTEXBROWSER_BIBTEX_VIEW=reconstructed +@define('BIBTEXBROWSER_BIBTEX_VIEW_FILTEREDOUT','comment|note|file'); + +// should Latex macros be executed (e.g. \'e -> é +@define('BIBTEXBROWSER_USE_LATEX2HTML',true); + +// Which is the first html level that should be used in embedded mode? +@define('BIBTEXBROWSER_HTMLHEADINGLEVEL', 2); + +@define('BIBTEXBROWSER_ACADEMIC_TOC', false); + +@define('BIBTEXBROWSER_DEBUG',false); + +// how to print authors names? +// default => as in the bibtex file +// USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT = true => "Meyer, Herbert" +// USE_INITIALS_FOR_NAMES = true => "Meyer H" +// USE_FIRST_THEN_LAST => Herbert Meyer +@define('USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT',false);// output authors in a comma separated form, e.g. "Meyer, H"? +@define('USE_INITIALS_FOR_NAMES',false); // use only initials for all first names? +@define('USE_FIRST_THEN_LAST',false); // use only initials for all first names? +@define('FORCE_NAMELIST_SEPARATOR', ''); // if non-empty, use this to separate multiple names regardless of USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT +@define('LAST_AUTHOR_SEPARATOR',' and '); + +@define('TYPES_SIZE',10); // number of entry types per table +@define('YEAR_SIZE',20); // number of years per table +@define('AUTHORS_SIZE',30); // number of authors per table +@define('TAGS_SIZE',30); // number of keywords per table +@define('READLINE_LIMIT',1024); +@define('Q_YEAR', 'year'); +@define('Q_YEAR_PAGE', 'year_page'); +@define('Q_YEAR_INPRESS', 'in press'); +@define('Q_YEAR_ACCEPTED', 'accepted'); +@define('Q_YEAR_SUBMITTED', 'submitted'); +@define('Q_FILE', 'bib'); +@define('Q_AUTHOR', 'author'); +@define('Q_AUTHOR_PAGE', 'author_page'); +@define('Q_TAG', 'keywords'); +@define('Q_TAG_PAGE', 'keywords_page'); +@define('Q_TYPE', 'type');// used for queries +@define('Q_TYPE_PAGE', 'type_page'); +@define('Q_ALL', 'all'); +@define('Q_ENTRY', 'entry'); +@define('Q_KEY', 'key'); +@define('Q_KEYS', 'keys'); // filter entries using a url-encoded, JSON-encoded array of bibtex keys +@define('Q_SEARCH', 'search'); +@define('Q_EXCLUDE', 'exclude'); +@define('Q_RESULT', 'result'); +@define('Q_ACADEMIC', 'academic'); +@define('Q_DB', 'bibdb'); +@define('Q_LATEST', 'latest'); +@define('Q_RANGE', 'range'); +@define('AUTHOR', 'author'); +@define('EDITOR', 'editor'); +@define('SCHOOL', 'school'); +@define('TITLE', 'title'); +@define('BOOKTITLE', 'booktitle'); +@define('YEAR', 'year'); +@define('BUFFERSIZE',100000); +@define('MULTIPLE_BIB_SEPARATOR',';'); +@define('METADATA_GS',true); +@define('METADATA_DC',true); +@define('METADATA_OPENGRAPH',true); +@define('METADATA_EPRINTS',false); + +// define sort order for special values in 'year' field +// highest number is sorted first +// don't exceed 0 though, since the values are added to PHP_INT_MAX +@define('ORDER_YEAR_INPRESS', -0); +@define('ORDER_YEAR_ACCEPTED', -1); +@define('ORDER_YEAR_SUBMITTED', -2); +@define('ORDER_YEAR_OTHERNONINT', -3); + + +// in embedded mode, we still need a URL for displaying bibtex entries alone +// this is usually resolved to bibtexbrowser.php +// but can be overridden in bibtexbrowser.local.php +// for instance with @define('BIBTEXBROWSER_URL',''); // links to the current page with ? +@define('BIBTEXBROWSER_URL',basename(__FILE__)); + +// *************** END CONFIGURATION + +define('Q_INNER_AUTHOR', '_author');// internally used for representing the author +define('Q_INNER_TYPE', 'x-bibtex-type');// used for representing the type of the bibtex entry internally +@define('Q_INNER_KEYS_INDEX', '_keys-index');// used for storing indices in $_GET[Q_KEYS] array diff --git a/src/bibtexbrowser.php b/src/bibtexbrowser.php index 613de6d..b00cfe3 100755 --- a/src/bibtexbrowser.php +++ b/src/bibtexbrowser.php @@ -49,190 +49,8 @@ function c($key) { // shortcut @include(@$_GET[Q_FILE].'.local.php'); @include(preg_replace('/\.php$/','.local.php',__FILE__)); -// the encoding of your bibtex file -@define('BIBTEX_INPUT_ENCODING','UTF-8');//@define('BIBTEX_INPUT_ENCODING','iso-8859-1');//define('BIBTEX_INPUT_ENCODING','windows-1252'); -// the encoding of the HTML output -@define('OUTPUT_ENCODING','UTF-8'); - -// print a warning if deprecated variable is used -if (defined('ENCODING')) { - echo 'ENCODING has been replaced by BIBTEX_INPUT_ENCODING and OUTPUT_ENCODING'; -} - -// number of bib items per page -// we use the same parameter 'num' as Google -@define('PAGE_SIZE',isset($_GET['num'])?(preg_match('/^\d+$/',$_GET['num'])?$_GET['num']:10000):14); +require_once "Definitions.php"; -// bibtexbrowser uses a small piece of Javascript to improve the user experience -// see http://en.wikipedia.org/wiki/Progressive_enhancement -// if you don't like it, you can be disable it by adding in bibtexbrowser.local.php -// @define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',false); -@define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',true); -@define('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');// this is the name of a function -@define('BIBLIOGRAPHYSECTIONS','DefaultBibliographySections');// this is the name of a function -@define('BIBLIOGRAPHYTITLE','DefaultBibliographyTitle');// this is the name of a function - -// shall we load MathJax to render math in $…$ in HTML? -@define('BIBTEXBROWSER_RENDER_MATH', true); -@define('MATHJAX_URI', '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML.js'); - -// the default jquery URI -@define('JQUERY_URI', '//code.jquery.com/jquery-1.5.1.min.js'); - -// can we load bibtex files on external servers? -@define('BIBTEXBROWSER_LOCAL_BIB_ONLY', true); - -// the default view in {SimpleDisplay,AcademicDisplay,RSSDisplay,BibtexDisplay} -@define('BIBTEXBROWSER_DEFAULT_DISPLAY','SimpleDisplay'); - -// the default template -@define('BIBTEXBROWSER_DEFAULT_TEMPLATE','HTMLTemplate'); - -// the target frame of menu links -@define('BIBTEXBROWSER_MENU_TARGET','main'); // might be define('BIBTEXBROWSER_MENU_TARGET','_self'); in bibtexbrowser.local.php - -@define('ABBRV_TYPE','index');// may be year/x-abbrv/key/none/index/keys-index - -// are robots allowed to crawl and index bibtexbrowser generated pages? -@define('BIBTEXBROWSER_ROBOTS_NOINDEX',false); - -//the default view in the "main" (right hand side) frame -@define('BIBTEXBROWSER_DEFAULT_FRAME','year=latest'); // year=latest,all and all valid bibtexbrowser queries - -// Wrapper to use when we are included by another script -@define('BIBTEXBROWSER_EMBEDDED_WRAPPER', 'NoWrapper'); - -// Main class to use -@define('BIBTEXBROWSER_MAIN', 'Dispatcher'); - -// default order functions -// Contract Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. -// can be @define('ORDER_FUNCTION','compare_bib_entry_by_title'); -// can be @define('ORDER_FUNCTION','compare_bib_entry_by_bibtex_order'); -@define('ORDER_FUNCTION','compare_bib_entry_by_year'); -@define('ORDER_FUNCTION_FINE','compare_bib_entry_by_month'); - -// only displaying the n newest entries -@define('BIBTEXBROWSER_NEWEST',5); - -@define('BIBTEXBROWSER_NO_DEFAULT', false); - -// BIBTEXBROWSER_LINK_STYLE defines which function to use to display the links of a bibtex entry -@define('BIBTEXBROWSER_LINK_STYLE','bib2links_default'); // can be 'nothing' (a function that does nothing) - -// do we add [bibtex] links ? -@define('BIBTEXBROWSER_BIBTEX_LINKS',true); -// do we add [pdf] links ? -@define('BIBTEXBROWSER_PDF_LINKS',true); -// do we add [doi] links ? -@define('BIBTEXBROWSER_DOI_LINKS',true); -// do we add [gsid] links (Google Scholar)? -@define('BIBTEXBROWSER_GSID_LINKS',true); - -// should pdf, doi, url, gsid links be opened in a new window? -@define('BIBTEXBROWSER_LINKS_TARGET','_self');// can be _blank (new window), _top (with frames) - -// should authors be linked to [none/homepage/resultpage] -// none: nothing -// their homepage if defined as @strings -// their publication lists according to this bibtex -@define('BIBTEXBROWSER_AUTHOR_LINKS','homepage'); - -// BIBTEXBROWSER_LAYOUT defines the HTML rendering layout of the produced HTML -// may be table/list/ordered_list/definition/none (for
,
    ,
    , nothing resp.). -// for list/ordered_list, the abbrevations are not taken into account (see ABBRV_TYPE) -// for ordered_list, the index is given by HTML directly (in increasing order) -@define('BIBTEXBROWSER_LAYOUT','table'); - -// should the original bibtex be displayed or a reconstructed one with filtering -// values: original/reconstructed -// warning, with reconstructed, the latex markup for accents/diacritics is lost -@define('BIBTEXBROWSER_BIBTEX_VIEW','original'); -// a list of fields that will not be shown in the bibtex view if BIBTEXBROWSER_BIBTEX_VIEW=reconstructed -@define('BIBTEXBROWSER_BIBTEX_VIEW_FILTEREDOUT','comment|note|file'); - -// should Latex macros be executed (e.g. \'e -> é -@define('BIBTEXBROWSER_USE_LATEX2HTML',true); - -// Which is the first html level that should be used in embedded mode? -@define('BIBTEXBROWSER_HTMLHEADINGLEVEL', 2); - -@define('BIBTEXBROWSER_ACADEMIC_TOC', false); - -@define('BIBTEXBROWSER_DEBUG',false); - -// how to print authors names? -// default => as in the bibtex file -// USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT = true => "Meyer, Herbert" -// USE_INITIALS_FOR_NAMES = true => "Meyer H" -// USE_FIRST_THEN_LAST => Herbert Meyer -@define('USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT',false);// output authors in a comma separated form, e.g. "Meyer, H"? -@define('USE_INITIALS_FOR_NAMES',false); // use only initials for all first names? -@define('USE_FIRST_THEN_LAST',false); // use only initials for all first names? -@define('FORCE_NAMELIST_SEPARATOR', ''); // if non-empty, use this to separate multiple names regardless of USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT -@define('LAST_AUTHOR_SEPARATOR',' and '); - -@define('TYPES_SIZE',10); // number of entry types per table -@define('YEAR_SIZE',20); // number of years per table -@define('AUTHORS_SIZE',30); // number of authors per table -@define('TAGS_SIZE',30); // number of keywords per table -@define('READLINE_LIMIT',1024); -@define('Q_YEAR', 'year'); -@define('Q_YEAR_PAGE', 'year_page'); -@define('Q_YEAR_INPRESS', 'in press'); -@define('Q_YEAR_ACCEPTED', 'accepted'); -@define('Q_YEAR_SUBMITTED', 'submitted'); -@define('Q_FILE', 'bib'); -@define('Q_AUTHOR', 'author'); -@define('Q_AUTHOR_PAGE', 'author_page'); -@define('Q_TAG', 'keywords'); -@define('Q_TAG_PAGE', 'keywords_page'); -@define('Q_TYPE', 'type');// used for queries -@define('Q_TYPE_PAGE', 'type_page'); -@define('Q_ALL', 'all'); -@define('Q_ENTRY', 'entry'); -@define('Q_KEY', 'key'); -@define('Q_KEYS', 'keys'); // filter entries using a url-encoded, JSON-encoded array of bibtex keys -@define('Q_SEARCH', 'search'); -@define('Q_EXCLUDE', 'exclude'); -@define('Q_RESULT', 'result'); -@define('Q_ACADEMIC', 'academic'); -@define('Q_DB', 'bibdb'); -@define('Q_LATEST', 'latest'); -@define('Q_RANGE', 'range'); -@define('AUTHOR', 'author'); -@define('EDITOR', 'editor'); -@define('SCHOOL', 'school'); -@define('TITLE', 'title'); -@define('BOOKTITLE', 'booktitle'); -@define('YEAR', 'year'); -@define('BUFFERSIZE',100000); -@define('MULTIPLE_BIB_SEPARATOR',';'); -@define('METADATA_GS',true); -@define('METADATA_DC',true); -@define('METADATA_OPENGRAPH',true); -@define('METADATA_EPRINTS',false); - -// define sort order for special values in 'year' field -// highest number is sorted first -// don't exceed 0 though, since the values are added to PHP_INT_MAX -@define('ORDER_YEAR_INPRESS', -0); -@define('ORDER_YEAR_ACCEPTED', -1); -@define('ORDER_YEAR_SUBMITTED', -2); -@define('ORDER_YEAR_OTHERNONINT', -3); - - -// in embedded mode, we still need a URL for displaying bibtex entries alone -// this is usually resolved to bibtexbrowser.php -// but can be overridden in bibtexbrowser.local.php -// for instance with @define('BIBTEXBROWSER_URL',''); // links to the current page with ? -@define('BIBTEXBROWSER_URL',basename(__FILE__)); - -// *************** END CONFIGURATION - -define('Q_INNER_AUTHOR', '_author');// internally used for representing the author -define('Q_INNER_TYPE', 'x-bibtex-type');// used for representing the type of the bibtex entry internally -@define('Q_INNER_KEYS_INDEX', '_keys-index');// used for storing indices in $_GET[Q_KEYS] array // for clean search engine links // we disable url rewriting @@ -1228,7 +1046,7 @@ class BibEntry { // we assume that "comment" is never latex code // but instead could contain HTML code (with links using the character "~" for example) // so "comment" is not transformed too - if ($name!='url' && $name!='comment' + if ($name!='url' && $name!='comment' && !preg_match('/^hp_/',$name) // homepage links should not be transformed with latex2html ) { $value = $this->transformValue($value); @@ -4152,7 +3970,7 @@ echo "\n".' -->'; ?> - From fe0010d3c0ed35361a8237a739e715af008f1286 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Jan 2018 19:29:18 -0500 Subject: [PATCH 07/14] autoloading for local testing setup --- .gitignore | 3 ++- public/index.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e4b8799..fe258fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*.dat \ No newline at end of file +*.dat +vendor \ No newline at end of file diff --git a/public/index.php b/public/index.php index c878444..bf18481 100644 --- a/public/index.php +++ b/public/index.php @@ -1,5 +1,8 @@ "bibacid-utf8.bib", From a6911c24961eb8d3c057bb20f62c2253166f9978 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 30 Jan 2018 21:12:57 -0500 Subject: [PATCH 08/14] on pause will instead focus on refactoring --- composer.json | 4 + composer.lock | 203 ++++++++++++++++++++++++++++++++++ public/bibtexbrowser.css | 28 ----- public/index.php | 30 +++-- src/Definitions.php | 3 +- src/bibacid-utf8.bib | 231 +++++++++++++++++++++++++++++++++++++++ src/bibtexbrowser.php | 194 +++++++++++++++++++++++++++++++- 7 files changed, 650 insertions(+), 43 deletions(-) create mode 100644 composer.lock delete mode 100644 public/bibtexbrowser.css create mode 100644 src/bibacid-utf8.bib diff --git a/composer.json b/composer.json index 8d0c94e..feafac6 100644 --- a/composer.json +++ b/composer.json @@ -20,5 +20,9 @@ }, "scripts": { "serve": "@php -S localhost:8080 -t public/" + }, + "require-dev": { + "monolog/monolog": "^1.23", + "kint-php/kint": "^2.2" } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..59127f8 --- /dev/null +++ b/composer.lock @@ -0,0 +1,203 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "fa3a6762d454ebe3dce634e74511aae2", + "packages": [], + "packages-dev": [ + { + "name": "kint-php/kint", + "version": "2.2", + "source": { + "type": "git", + "url": "https://github.com/kint-php/kint.git", + "reference": "b091715eadaf6e1a7ef927f3e81d1004611d2aea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kint-php/kint/zipball/b091715eadaf6e1a7ef927f3e81d1004611d2aea", + "reference": "b091715eadaf6e1a7ef927f3e81d1004611d2aea", + "shasum": "" + }, + "require": { + "php": ">=5.1.2" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.0", + "phpunit/phpunit": "^4.0", + "symfony/finder": "^2.6" + }, + "type": "library", + "autoload": { + "files": [ + "init.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rokas Šleinius", + "homepage": "https://github.com/raveren" + }, + { + "name": "Jonathan Vollebregt", + "homepage": "https://github.com/jnvsor" + }, + { + "name": "Contributors", + "homepage": "https://github.com/kint-php/kint/graphs/contributors" + } + ], + "description": "Kint - debugging tool for PHP developers", + "homepage": "https://kint-php.github.io/kint/", + "keywords": [ + "debug", + "kint", + "php" + ], + "time": "2017-09-06T17:46:03+00:00" + }, + { + "name": "monolog/monolog", + "version": "1.23.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "^5.3|^6.0" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2017-06-19T01:22:40+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=4" + }, + "platform-dev": [] +} diff --git a/public/bibtexbrowser.css b/public/bibtexbrowser.css deleted file mode 100644 index f286b92..0000000 --- a/public/bibtexbrowser.css +++ /dev/null @@ -1,28 +0,0 @@ -.datePublished { - background-color: blue; -} -.btb-header { } -.rheader { - font-size: large -} -.sheader { - padding-top: 10px; -} -.bibref { - /*padding:3px; */ -/* padding-left:15px; */ - vertical-align:top; - color:white;} -/*.bibtitle { font-weight:bold; }*/ -.bibitem { - text-indent:-35px; - padding-left:35px; -} -.bibbooktitle { font-style:italic; } -.count { color:gray } -.sheader { font-weight:bold; font-size: large;} -.volume { font-style: italic; } - -body { - background:green; -} diff --git a/public/index.php b/public/index.php index bf18481..63fcba9 100644 --- a/public/index.php +++ b/public/index.php @@ -1,15 +1,27 @@ "bibacid-utf8.bib", - "all" => 1, - "author" => "", - "academic" => 1 -); +require_once "../src/bibtexbrowser.php"; -$browser = new Monperrus\BibtexBrowser\Bibliography($config); -$browser->print(); + +//require_once "../vendor/autoload.php"; + +// use Monperrus\BibtexBrowser\Bibliography; + + + +// $config = array("bib" => "bibacid-utf8.bib", +// "all" => 1, +// "author" => "", +// "academic" => 1 +// ); + +// $_GET['menu']=1; +// $browser = new Monperrus\BibtexBrowser\Bibliography($config); +// $browser->print(); +//s($_SERVER); diff --git a/src/Definitions.php b/src/Definitions.php index 89a3394..46506a5 100644 --- a/src/Definitions.php +++ b/src/Definitions.php @@ -179,7 +179,8 @@ if (defined('ENCODING')) { // this is usually resolved to bibtexbrowser.php // but can be overridden in bibtexbrowser.local.php // for instance with @define('BIBTEXBROWSER_URL',''); // links to the current page with ? -@define('BIBTEXBROWSER_URL',basename(__FILE__)); +//@define('BIBTEXBROWSER_URL',basename(__FILE__)); +@define('BIBTEXBROWSER_URL',parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); // *************** END CONFIGURATION diff --git a/src/bibacid-utf8.bib b/src/bibacid-utf8.bib new file mode 100644 index 0000000..1c04146 --- /dev/null +++ b/src/bibacid-utf8.bib @@ -0,0 +1,231 @@ + + +@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} +} + +@article{croatiantest, + author = "Strabi{\'{c}} Strabi\'{c}", + title = "Fancy accents bug", + year = 2015 +} + +@article{kjsdf 8, + title = "Entry with + in the key", + author = "Foo Bar", + year = 2017 +} diff --git a/src/bibtexbrowser.php b/src/bibtexbrowser.php index b00cfe3..f70d564 100755 --- a/src/bibtexbrowser.php +++ b/src/bibtexbrowser.php @@ -49,8 +49,191 @@ function c($key) { // shortcut @include(@$_GET[Q_FILE].'.local.php'); @include(preg_replace('/\.php$/','.local.php',__FILE__)); -require_once "Definitions.php"; +// the encoding of your bibtex file +@define('BIBTEX_INPUT_ENCODING','UTF-8');//@define('BIBTEX_INPUT_ENCODING','iso-8859-1');//define('BIBTEX_INPUT_ENCODING','windows-1252'); +// the encoding of the HTML output +@define('OUTPUT_ENCODING','UTF-8'); + +// print a warning if deprecated variable is used +if (defined('ENCODING')) { + echo 'ENCODING has been replaced by BIBTEX_INPUT_ENCODING and OUTPUT_ENCODING'; +} + +// number of bib items per page +// we use the same parameter 'num' as Google +@define('PAGE_SIZE',isset($_GET['num'])?(preg_match('/^\d+$/',$_GET['num'])?$_GET['num']:10000):14); + +// bibtexbrowser uses a small piece of Javascript to improve the user experience +// see http://en.wikipedia.org/wiki/Progressive_enhancement +// if you don't like it, you can be disable it by adding in bibtexbrowser.local.php +// @define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',false); +@define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',true); +@define('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');// this is the name of a function +@define('BIBLIOGRAPHYSECTIONS','DefaultBibliographySections');// this is the name of a function +@define('BIBLIOGRAPHYTITLE','DefaultBibliographyTitle');// this is the name of a function +// shall we load MathJax to render math in $…$ in HTML? +@define('BIBTEXBROWSER_RENDER_MATH', true); +@define('MATHJAX_URI', '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML.js'); + +// the default jquery URI +@define('JQUERY_URI', '//code.jquery.com/jquery-1.5.1.min.js'); + +// can we load bibtex files on external servers? +@define('BIBTEXBROWSER_LOCAL_BIB_ONLY', true); + +// the default view in {SimpleDisplay,AcademicDisplay,RSSDisplay,BibtexDisplay} +@define('BIBTEXBROWSER_DEFAULT_DISPLAY','SimpleDisplay'); + +// the default template +@define('BIBTEXBROWSER_DEFAULT_TEMPLATE','HTMLTemplate'); + +// the target frame of menu links +@define('BIBTEXBROWSER_MENU_TARGET','main'); // might be define('BIBTEXBROWSER_MENU_TARGET','_self'); in bibtexbrowser.local.php + +@define('ABBRV_TYPE','index');// may be year/x-abbrv/key/none/index/keys-index + +// are robots allowed to crawl and index bibtexbrowser generated pages? +@define('BIBTEXBROWSER_ROBOTS_NOINDEX',false); + +//the default view in the "main" (right hand side) frame +@define('BIBTEXBROWSER_DEFAULT_FRAME','year=latest'); // year=latest,all and all valid bibtexbrowser queries + +// Wrapper to use when we are included by another script +@define('BIBTEXBROWSER_EMBEDDED_WRAPPER', 'NoWrapper'); + +// Main class to use +@define('BIBTEXBROWSER_MAIN', 'Dispatcher'); + +// default order functions +// Contract Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. +// can be @define('ORDER_FUNCTION','compare_bib_entry_by_title'); +// can be @define('ORDER_FUNCTION','compare_bib_entry_by_bibtex_order'); +@define('ORDER_FUNCTION','compare_bib_entry_by_year'); +@define('ORDER_FUNCTION_FINE','compare_bib_entry_by_month'); + +// only displaying the n newest entries +@define('BIBTEXBROWSER_NEWEST',5); + +@define('BIBTEXBROWSER_NO_DEFAULT', false); + +// BIBTEXBROWSER_LINK_STYLE defines which function to use to display the links of a bibtex entry +@define('BIBTEXBROWSER_LINK_STYLE','bib2links_default'); // can be 'nothing' (a function that does nothing) + +// do we add [bibtex] links ? +@define('BIBTEXBROWSER_BIBTEX_LINKS',true); +// do we add [pdf] links ? +@define('BIBTEXBROWSER_PDF_LINKS',true); +// do we add [doi] links ? +@define('BIBTEXBROWSER_DOI_LINKS',true); +// do we add [gsid] links (Google Scholar)? +@define('BIBTEXBROWSER_GSID_LINKS',true); + +// should pdf, doi, url, gsid links be opened in a new window? +@define('BIBTEXBROWSER_LINKS_TARGET','_self');// can be _blank (new window), _top (with frames) + +// should authors be linked to [none/homepage/resultpage] +// none: nothing +// their homepage if defined as @strings +// their publication lists according to this bibtex +@define('BIBTEXBROWSER_AUTHOR_LINKS','homepage'); + +// BIBTEXBROWSER_LAYOUT defines the HTML rendering layout of the produced HTML +// may be table/list/ordered_list/definition/none (for
,
    ,
    , nothing resp.). +// for list/ordered_list, the abbrevations are not taken into account (see ABBRV_TYPE) +// for ordered_list, the index is given by HTML directly (in increasing order) +@define('BIBTEXBROWSER_LAYOUT','table'); + +// should the original bibtex be displayed or a reconstructed one with filtering +// values: original/reconstructed +// warning, with reconstructed, the latex markup for accents/diacritics is lost +@define('BIBTEXBROWSER_BIBTEX_VIEW','original'); +// a list of fields that will not be shown in the bibtex view if BIBTEXBROWSER_BIBTEX_VIEW=reconstructed +@define('BIBTEXBROWSER_BIBTEX_VIEW_FILTEREDOUT','comment|note|file'); + +// should Latex macros be executed (e.g. \'e -> é +@define('BIBTEXBROWSER_USE_LATEX2HTML',true); + +// Which is the first html level that should be used in embedded mode? +@define('BIBTEXBROWSER_HTMLHEADINGLEVEL', 2); + +@define('BIBTEXBROWSER_ACADEMIC_TOC', false); + +@define('BIBTEXBROWSER_DEBUG',false); + +// how to print authors names? +// default => as in the bibtex file +// USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT = true => "Meyer, Herbert" +// USE_INITIALS_FOR_NAMES = true => "Meyer H" +// USE_FIRST_THEN_LAST => Herbert Meyer +@define('USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT',false);// output authors in a comma separated form, e.g. "Meyer, H"? +@define('USE_INITIALS_FOR_NAMES',false); // use only initials for all first names? +@define('USE_FIRST_THEN_LAST',false); // use only initials for all first names? +@define('FORCE_NAMELIST_SEPARATOR', ''); // if non-empty, use this to separate multiple names regardless of USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT +@define('LAST_AUTHOR_SEPARATOR',' and '); + +@define('TYPES_SIZE',10); // number of entry types per table +@define('YEAR_SIZE',20); // number of years per table +@define('AUTHORS_SIZE',30); // number of authors per table +@define('TAGS_SIZE',30); // number of keywords per table +@define('READLINE_LIMIT',1024); +@define('Q_YEAR', 'year'); +@define('Q_YEAR_PAGE', 'year_page'); +@define('Q_YEAR_INPRESS', 'in press'); +@define('Q_YEAR_ACCEPTED', 'accepted'); +@define('Q_YEAR_SUBMITTED', 'submitted'); +@define('Q_FILE', 'bib'); +@define('Q_AUTHOR', 'author'); +@define('Q_AUTHOR_PAGE', 'author_page'); +@define('Q_TAG', 'keywords'); +@define('Q_TAG_PAGE', 'keywords_page'); +@define('Q_TYPE', 'type');// used for queries +@define('Q_TYPE_PAGE', 'type_page'); +@define('Q_ALL', 'all'); +@define('Q_ENTRY', 'entry'); +@define('Q_KEY', 'key'); +@define('Q_KEYS', 'keys'); // filter entries using a url-encoded, JSON-encoded array of bibtex keys +@define('Q_SEARCH', 'search'); +@define('Q_EXCLUDE', 'exclude'); +@define('Q_RESULT', 'result'); +@define('Q_ACADEMIC', 'academic'); +@define('Q_DB', 'bibdb'); +@define('Q_LATEST', 'latest'); +@define('Q_RANGE', 'range'); +@define('AUTHOR', 'author'); +@define('EDITOR', 'editor'); +@define('SCHOOL', 'school'); +@define('TITLE', 'title'); +@define('BOOKTITLE', 'booktitle'); +@define('YEAR', 'year'); +@define('BUFFERSIZE',100000); +@define('MULTIPLE_BIB_SEPARATOR',';'); +@define('METADATA_GS',true); +@define('METADATA_DC',true); +@define('METADATA_OPENGRAPH',true); +@define('METADATA_EPRINTS',false); + +// define sort order for special values in 'year' field +// highest number is sorted first +// don't exceed 0 though, since the values are added to PHP_INT_MAX +@define('ORDER_YEAR_INPRESS', -0); +@define('ORDER_YEAR_ACCEPTED', -1); +@define('ORDER_YEAR_SUBMITTED', -2); +@define('ORDER_YEAR_OTHERNONINT', -3); + + +// in embedded mode, we still need a URL for displaying bibtex entries alone +// this is usually resolved to bibtexbrowser.php +// but can be overridden in bibtexbrowser.local.php +// for instance with @define('BIBTEXBROWSER_URL',''); // links to the current page with ? +//@define('BIBTEXBROWSER_URL',basename(__FILE__)); +@define('BIBTEXBROWSER_URL',''); + +// *************** END CONFIGURATION + +define('Q_INNER_AUTHOR', '_author');// internally used for representing the author +define('Q_INNER_TYPE', 'x-bibtex-type');// used for representing the type of the bibtex entry internally +@define('Q_INNER_KEYS_INDEX', '_keys-index');// used for storing indices in $_GET[Q_KEYS] array // for clean search engine links // we disable url rewriting @@ -61,6 +244,8 @@ require_once "Definitions.php"; function nothing() {} + + function config_value($key) { global $CONFIGURATION; if (isset($CONFIGURATION[$key])) { return $CONFIGURATION[$key]; } @@ -285,7 +470,6 @@ if (!function_exists('createMenuManager')) { function createMenuManager() { $x = new MenuManager(); return $x;} } - //////////////////////////////////////////////////////// /** is a generic parser of bibtex files. @@ -3907,7 +4091,6 @@ dd { <BODY> and TITLE) usage:
    @@ -3921,6 +4104,7 @@ usage:
           getTitle()
      * $title: title of the page
      */
    +
     function HTMLTemplate($content) {
     
     // when we load a page with AJAX
    @@ -3957,14 +4141,14 @@ if (method_exists($content, 'getTitle')) {
     
     // now the CSS
     echo '';
     
     ?>
    
    From a0daf5c44c5fedfcb74c165f882e68e76bdadd34 Mon Sep 17 00:00:00 2001
    From: Chris 
    Date: Wed, 31 Jan 2018 19:19:12 -0500
    Subject: [PATCH 09/14] figured out how to ensure correct html wrapper used
     when script is required from outside its cwd
    
    ---
     composer.json         |  2 +-
     public/embed.php      | 25 +++++++++++++++++++++++++
     public/index.php      | 29 +++++++++--------------------
     src/bibtexbrowser.php | 11 ++++++-----
     4 files changed, 41 insertions(+), 26 deletions(-)
     create mode 100644 public/embed.php
    
    diff --git a/composer.json b/composer.json
    index feafac6..b522c95 100644
    --- a/composer.json
    +++ b/composer.json
    @@ -19,7 +19,7 @@
             }
         },
         "scripts": {
    -        "serve": "@php -S localhost:8080 -t public/"
    +        "serve": "@php -S localhost:29896 -t public/"
         },
         "require-dev": {
             "monolog/monolog": "^1.23",
    diff --git a/public/embed.php b/public/embed.php
    new file mode 100644
    index 0000000..d1ba77e
    --- /dev/null
    +++ b/public/embed.php
    @@ -0,0 +1,25 @@
    +
    +
    +
    +
    +HTML;
    +
    +$_GET['library']=1;
    +require_once('../src/bibtexbrowser.php');
    +$db = new BibDataBase();
    +$db->load('bibacid-utf8.bib');
    +$query = array('year'=>'1997');
    +$entries=$db->multisearch($query);
    +uasort($entries, 'compare_bib_entries');
    +foreach ($entries as $bibentry) {
    +    print $bibentry->toHTML()."
    "; +} + +print << + +HTML; +exit; diff --git a/public/index.php b/public/index.php index 63fcba9..8e45e1a 100644 --- a/public/index.php +++ b/public/index.php @@ -1,27 +1,16 @@ "bibacid-utf8.bib", -// "all" => 1, -// "author" => "", -// "academic" => 1 -// ); +$config = array("bib" => "bibacid-utf8.bib", + "all" => 1, + "author" => "", + "academic" => 1 +); -// $_GET['menu']=1; -// $browser = new Monperrus\BibtexBrowser\Bibliography($config); -// $browser->print(); -//s($_SERVER); +$browser = new Bibliography($config); +$browser->print(); diff --git a/src/bibtexbrowser.php b/src/bibtexbrowser.php index f70d564..e3aae03 100755 --- a/src/bibtexbrowser.php +++ b/src/bibtexbrowser.php @@ -328,7 +328,7 @@ function _zetDB($bibtex_filenames) { // to automate dectection of faulty links with tools such as webcheck header('HTTP/1.1 404 Not found'); // escape $bib to prevent XSS - $escapedBib = htmlEntities($bib, ENT_QUOTES); + htmlEntities($bib, ENT_QUOTES); die('the bib file '.$escapedBib.' does not exist !'); } } // end for each @@ -4531,7 +4531,7 @@ class Dispatcher { } // should call method display() on $x - $fun = $this->wrapper; + $fun = BIBTEXBROWSER_DEFAULT_TEMPLATE;//$this->wrapper; $fun($x); $this->clearQuery(); @@ -4541,7 +4541,7 @@ class Dispatcher { // if some contents have already been sent, for instance if we are included // this means doing nothing if ( headers_sent() == false ) { /* to avoid sending an unnecessary frameset */ - header("Location: ".$_SERVER['SCRIPT_NAME']."?frameset&bib=".$_GET[Q_FILE]); + header("Location: ".$_SERVER['SCRIPT_NAME']."?frameset&bib=".$_GET[Q_FILE]); } } } @@ -4668,7 +4668,8 @@ class Dispatcher { function menu() { $menu = createMenuManager(); $menu->setDB($this->getDB()); - $fun = $this->wrapper; + // why does //$this->wrapper; = no wrapper? + $fun = BIBTEXBROWSER_DEFAULT_TEMPLATE; $fun($menu); return 'END_DISPATCH'; } @@ -4759,7 +4760,7 @@ class Dispatcher { Date: Wed, 31 Jan 2018 19:44:43 -0500 Subject: [PATCH 10/14] fix broken test for travis --- .travis.yml | 2 +- src/Bibliography.php | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8fb8394..11abd61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,6 @@ php: script: - curl -L -o reflectivedoc.php https://www.monperrus.net/martin/reflectivedoc.php.txt - curl -L -o gakowiki-syntax.php https://www.monperrus.net/martin/gakowiki-syntax.php.txt - - phpunit bibtexbrowser-test.php + - phpunit tests/bibtexbrowser-test.php sudo: false diff --git a/src/Bibliography.php b/src/Bibliography.php index 00e4ede..f1f9c8a 100644 --- a/src/Bibliography.php +++ b/src/Bibliography.php @@ -12,16 +12,11 @@ class Bibliography "library" => null, "academic" => null); - private $config = array(); - public function __construct($userConfig = array()) { // (PHP 5 >= 5.3.0, PHP 7) - $this->config = array_replace($this->defaultConfig, $userConfig); - - if (!isset($_GET['bib'])) { - $_GET['bib'] = $this->config['bib']; - } + // $userConfig precedent over defaultConfig; $_GET over $userConfig + $_GET = array_replace($this->defaultConfig, $userConfig, $_GET); } public function print() From 025ec43ee5fca177806c9eb81dcf3e070a299dad Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 31 Jan 2018 20:35:39 -0500 Subject: [PATCH 11/14] bump --- tests/bibtexbrowser-test.php | 6 +- tests/reflectivedoc.php | 718 +++++++++++++++++++++++++++++++++++ 2 files changed, 721 insertions(+), 3 deletions(-) create mode 100644 tests/reflectivedoc.php diff --git a/tests/bibtexbrowser-test.php b/tests/bibtexbrowser-test.php index e54fca5..a8728f1 100755 --- a/tests/bibtexbrowser-test.php +++ b/tests/bibtexbrowser-test.php @@ -40,7 +40,7 @@ if (!is_file('reflectivedoc.php')) { } require('reflectivedoc.php'); $nsnippet=0; -foreach(getAllSnippetsInFile('bibtexbrowser.php') as $snippet) { +foreach(getAllSnippetsInFile('../src/bibtexbrowser.php') as $snippet) { ob_start(); eval($snippet); ob_get_clean(); @@ -137,7 +137,7 @@ class BTBTest extends PHPUnit_Framework_TestCase { // listing the CSS classes $css_classes_before = $this->extract_css_classes($first_entry->toHTML()); - + // IEEE style bibtexbrowser_configure('BIBLIOGRAPHYSTYLE','JanosBibliographyStyle'); $this->assertEquals("Foo Bar and Jane Doe, \"An Article\", In New Results, vol. 5, pp. 1-2, 2009.\n ",strip_tags($first_entry->toHTML())); @@ -646,7 +646,7 @@ class BTBTest extends PHPUnit_Framework_TestCase { ob_get_clean(); $this->assertEquals("[2]", $btb->getEntryByKey('aKey')->getAbbrv()); $this->assertEquals("[1]", $btb->getEntryByKey('aKey-withSlash')->getAbbrv()); - + } function test_identity() { diff --git a/tests/reflectivedoc.php b/tests/reflectivedoc.php new file mode 100644 index 0000000..99d3c23 --- /dev/null +++ b/tests/reflectivedoc.php @@ -0,0 +1,718 @@ +parse($text); +} + + +?>\n different + + */ + +if (defined('gakoparser.php')) return; +define('gakoparser.php',true); + +class Delimiter{} + +class GakoParserException extends Exception {} + +/** provides a parametrizable parser. The main method is "parse" */ +class GakoParser { + + /** is the PHP5 constructor. */ + function __construct() { + // an array of Delimiter objects + $this->start_delimiters = array(); + $this->end_delimiters = array(); + $this->nonesting = array(); + $this->delegate = array(); + } + + /** specifies that $tag can not contain nested tags */ + function noNesting($tag) { + $this->nonesting[] = $tag; + return $this; + } + + function setDelegate($obj) { + $this->delegate = $obj; + return $this; + } + + function addDelim($name, $delim) { + return $this->addDelimX($name, $delim, $delim); + } + + /** adds a trigger $tag -> execution of function $name */ + function addTag($name, $tag) { + $start = substr($tag,0,strlen($tag)-1); + $end = substr($tag,strlen($tag)-1); + return $this->addDelimX($name, $start, $end); + } + + /** setDelegate must be called before this method */ + function addDelimX($name, $start, $end) { + if (!method_exists($this->delegate,$name)) {throw new GakoParserException('no method '.$method.' in delegate!');} + + $x = new Delimiter(); + $x->value = $start; +// $x->type = 'start'; + $x->action = $name; + + $y = new Delimiter(); + $y->value = $end; +// $y->type = 'end'; + $y->action = $name; + + // crossing links + $y->startDelim = $x; + $x->endDelim = $y; + + if (in_array($start, $this->get_start_delimiters())) { + throw new GakoParserException("delimiter ".$start." already exists"); + } + + $this->start_delimiters[$start] = $x; + $this->end_delimiters[$end] = $y; + return $this; + } + + function get_start_delimiters() { + return array_keys($this->start_delimiters); + } + + function get_end_delimiters() { + return array_keys($this->end_delimiters); + } + + function array_preg_quote($x) { + $result = array(); + foreach($x as $k) { $result[] = preg_quote($k, '/'); } + return $result; + } + + function addDelimXML($name, $delim) { + return $this->addDelimX($name, '<'.$delim.'>', ''); + } + + function getCandidateDelimiters_man($str) { + $result = array(); + + for ( $i=0; $i < strlen( $str ); $i++) { + foreach(array_merge($this->get_start_delimiters(),$this->get_end_delimiters()) as $v) { + $new_fragment = substr($str, $i, strlen($v)); + if ($new_fragment === $v) { + $x = array(); + $x[0] = array(); + $x[0][0] = $v; + $x[0][1] = $i; + $result[] = $x; + } + } + } + //print_r($result); + return $result; + } + + function getCandidateDelimiters($str) { + //return $this->getCandidateDelimiters_man($str); + return $this->getCandidateDelimiters_preg($str); + } + + function getCandidateDelimiters_preg($str) { + // getting the start delimiters + preg_match_all('/'.implode('|',array_merge($this->array_preg_quote($this->get_start_delimiters()),$this->array_preg_quote($this->get_end_delimiters()))).'/', $str, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE ); + return $matches; + } + + function parse($str) { +// echo "---------parse $str\n"; + $method = '__pre'; + if (method_exists($this->delegate,$method)) { + $str = $this->delegate->$method($str); + } + + $matches = $this->getCandidateDelimiters($str); + +// print_r($matches); + + //echo 'parse '.$str.'
    '; + // the stack contains the current markup environment + $init = new Delimiter(); $init->action = '__init__'; $init->value = '__init__'; $init->endDelim = $init; + $stack = array($init); + $strings = array(1=>''); + $last = 0; + +// if (count($matches) == 0) return $str; + +// print_r($matches); + +// $strings[1] = substr($str, 0, $matches[0][0][1]); + + // for each tags found + foreach ( $matches as $_ ) { + + list($v, $pos) = $_[0]; + +// echo "studying ".$v." at ".$pos." (last=".$last.")\n"; + + // if $_ is a start delimiter, + // we'll get '' in $k + //echo $stack[0]; + if (isset($this->end_delimiters[$v]) +// && $stack[0] != '__init__' + && $stack[0]->endDelim->value == $v + && $pos>=$last + ) { + $k = $stack[0]->endDelim->action; + + $strings[count($stack)] .= substr($str,$last, $pos-$last); + +// echo "popping ".$k." at ".$pos." with ".$v." (last=".$last.", stack=".count($stack).")\n"; + + $closedtag = array_shift($stack); + + $method = $k; +// echo $method." ".$value. "\n"; + $value = $strings[count($stack)+1]; + $transformed = $this->delegate->$method($value); +// echo $transformed ."---".$value." \n"; + $strings[count($stack)] .= $transformed; + + $strings[count($stack)+1] = ''; + $last = $pos+strlen($v); + + } + + // certain tags do not support nesting + else if (!in_array($stack[0]->action, $this->nonesting) + && in_array($v, $this->get_start_delimiters()) && $pos >= $last) + { + $delim = $this->start_delimiters[$v]; + $k = $delim->action; + +// echo "putting ".$k." at ".$pos." with ".$last."
    \n"; + + if ($pos>$last) { + $strings[count($stack)] .= substr($str, $last, $pos-$last); + } + array_unshift($stack, $delim); + // init the new stack + $strings[count($stack)] = ''; + $last = $pos+strlen($v); +// print_r($strings); + + } else { + //die('oops'); + } + + } // end foreach + + + if ($stack[0]->action!="__init__") { + //print_r($strings); + throw new GakoParserException("parsing error: ending with ".$stack[0]->action. " ('".$strings[1]."')"); + } + + $result = $strings[count($stack)]; + + // adding the rest + if ($lastdelegate,$method)) { + $result = $this->delegate->$method($result); + } + //echo "$$$$$ ".$result."\n"; + + return $result; + + } +} + + +?> + +// high level +$parser = create_wiki_parser(); +$html_text = $parser->parse($wiki_text); + +// low level + $parser = new Gakoparser(); + $parser->setDelegate(new MarkupInterpreter()); + $parser->addDelim('bold','**'); + echo $parser->parse('hello **world**'); + +
    + */ + + +class GakowikiMarkupToHTMLTranslator { + + var $toc = array(); + + var $references = array(); + + /** replaces all line breaks by "__newline__" that are meant to replaced back by a call to __post() */ + function __pre($str) { + $result = $str; + + // we often use nelines to have pretty HTML code + // such as in tables + // however, they are no "real" newlines to be transformed in
    + $result = preg_replace("/>\s*(\n|\r\n)/",'>__newline__',$result); + return $result; + } + + function bib($str) { + $this->references[] = $str; + return '['.count($this->references).'] '.$str; + } + + function cite($str) { + return "@@@".$str."@@@"; + } + + function escape_newline($str) { + return preg_replace("/(\n|\r\n)/","__newline__",$str); + } + + function toc($str) { + return '+++TOC+++'; + } + + function __post($str) { + $result = $str; + $result = preg_replace("/(\n|\r\n)/","
    \n",$result); + + // workaround to support the semantics change in pre mode + // and the semantics of embedded HTML + $result = preg_replace("/__newline__/","\n",$result);// must be at the end + + // cleaning the additional
    + // this is really nice + $result = preg_replace("/(<\/h.>)/i","\\1 ",$result); + + // adding the table of contents + $result = str_replace($this->toc(''),implode('
    ',$this->toc),$result); + + // adding the references + $citeregexp = '/@@@(.*?)@@@/'; + if (preg_match_all($citeregexp,$result,$matches)) { + foreach($matches[1] as $m) { + $theref = ''; + foreach ($this->references as $k => $ref) { + if (preg_match('/'.preg_quote($m).'/i', $ref)) { +//echo $m.' '.$ref; + // if we have already a match it is not deterministic + if ($theref!='') $result = "undeterministic citation: ".$m; + $theref = $ref; + $result = preg_replace('/@@@'.preg_quote($m).'@@@/i', '['.($k+1).']', $result); + } + } + } + } + + return $result; + } + + /** adds
     tags and prevents newline to be replaced by 
    by __post */ + function pre($str) { + return '
    '.$this->escape_newline($str).'
    '; + } + + /** prevents newline to be replaced by
    by __post */ + function unwrap($str) { + return $this->escape_newline($str); + } + + /** adds tags */ + function bold($str) { + return ''.$str.''; + } + + /** adds tags */ + function italic($str) { + return ''.$str.''; + } + + function table($str) { + $result = ''; + foreach(preg_split('/\n/',$str) as $line) { + if (strlen(trim($line))>0) { + $result .= '
'; + foreach(preg_split('/&&/',$line) as $field) { + $result .= ''; + + } + $result .= ''; + } + } + + return '
'.$field.'
'.$result.'
'; + } + + + function __create_anchor($m) { + return preg_replace("/[^a-zA-Z]/","",$m); + } + function h2($str) { + $tag = $this->__create_anchor($str); + $this->toc[] = "".$str.""; + return ''.'

'.$str."

"; + } + + function h3($str) { + $tag = $this->__create_anchor($str); + $this->toc[] = "  ".$str.""; + return ''.'

'.$str."

"; + } + + function monotype($str) { + return ''.str_replace('<','<',$str).''; + } + + function link($str) { + + if (preg_match('/(.*)\|(.*)/',$str, $matches)) { + $rawurl = $matches[1]; + $text = $matches[2]; + } else {$rawurl=$str;$text=$str;} + + $url=$rawurl; + + if (!preg_match("/(#|^http|^mailto)/",$rawurl)) { + if (function_exists('logical2url')) { + $url=logical2url($rawurl); + } else { + $url=$rawurl; + + } + } + + return ''.trim($text).''; + } + + function phpcode($str) { + ob_start(); + eval($str); + return $this->escape_newline(ob_get_clean()); + } + + function phpcode2($str) { + return gk_wiki2html($this->phpcode($str)); + } + + function a($str) { + return ''; + } + + function script($str) { + return 'escape_newline($str).''; + } + + function img($str) { + return ''; + } + + function img2($str) { + return ''; + } + + + function html($str) { + return '<'.$str.'>'; + } + + function iframe($str) { + return ''; + } + + + function comment($str) { + return ''; // comments are discarded + } + + function silent($str) { + return ''; + } + +} // end class + + +/** returns a parser object to parse wiki syntax. + +The returned object may be used with the parse method: +
+$parser = create_wiki_parser();
+$html_text = $parser->parse($wiki_text);
+
+*/ +function create_wiki_parser() { + $x = new Gakoparser(); + return $x->setDelegate(new GakowikiMarkupToHTMLTranslator()) + ->addDelimX('comment','')->noNesting('comment') + + ->addDelim('bold','**') + ->addDelim('italic','//')//->noNesting('italic') + ->addDelim('bold',"'''") + ->addDelim('monotype',"''")->noNesting('monotype') + ->addDelim('h2',"=====") // the longest comes before, it has the highest priority + ->addDelim('h3',"====") + ->addDelim('table',"|||") + ->addDelimXML('pre','pre')->noNesting('pre') // this is essential otherwise you have infinite loops + ->addDelimX('pre','{{{','}}}')->noNesting('pre2') // à la Google Code wiki syntax + ->addDelimX('link','[[',']]')->noNesting('link') + ->addDelimX('phpcode2','')->noNesting('phpcode2') + ->addDelimX('phpcode','') ->noNesting('phpcode') + ->addDelimX('img2','')->noNesting('img2') + ->addDelim('img','%%')->noNesting('img')// huge bug when I did this for 1000 index :( + ->addDelimX('script','') ->noNesting('script') + ->addDelimX('unwrap','^^','^^') + ->addTag('toc','+++TOC+++') + + ->addDelimX('a','')->noNesting('a') // important to support cross tags + + ->addDelimX('iframe','')->noNesting('iframe') + + // Dec 30 2012 + ->addDelimX('bib','\bib{','}') + ->addDelimX('cite','\cite{','}') + + // this one is really not good + //->addDelimX('html','<','>')->noNesting('html') // a link often contains // (e.g. http:// which clash with italics + ; +} // end create_wiki_parser + +function gakowiki__doc() { +?> +Syntax specification:
+**this is bold**
+//this is italic//
+''this is code''
+[[link to a page on this wiki]],[[http://www.google.fr|link to google]]
+

=====Section=====

+

====Subsection====

+', $result); + $result = str_replace('</pre>', '', $result); + // removes lines prefixed "*" often used to have nice API comments + $result = preg_replace('/^.*?\*/m', '', $result); + return '
'.$result.'
'; + //return gk_wiki2html($comment); + } catch (GakoParserException $e) {return '
'.$comment.'
';} +} + +/** outputs the API doc of the function called $fname */ +function printDocFuncName($fname, $prefix='') { + $funcdeclared = new ReflectionFunction($fname); + return printDocFuncObj($funcdeclared, $prefix); +} + +function getComment($funcdeclared) { + $comment = trim(substr($funcdeclared->getDocComment(),3,-2)); + return $comment; +} +function printDocFuncObj($funcdeclared, $prefix='', $documented = true) { + $comment = trim(substr($funcdeclared->getDocComment(),3,-2)); + if ($documented && strlen($comment)<1) { return ''; } + $res = ""; + $res .= '
'; + $res .= ''.$prefix.$funcdeclared->getName().''; + $res .= '('.implode(', ',array_map('f',$funcdeclared->getParameters())).') '; + $res .= printGk($comment); + $res .= '
'; + return $res; +} + +// Anonymous functions are available only since PHP 5.3.0 +function f($x){return '$'.$x->getName();} + + +/** this is printNewFunctions + the main limitation is that this does not fully work if there is an exit/die in the included script +*/ +function printNewFunctions($beforef) { + $afterf=get_defined_functions(); + + + foreach($afterf['user'] as $fname ) { + $funcdeclared = new ReflectionFunction($fname); + if (!in_array($fname,$beforef['user']) && $funcdeclared->getFileName()==realpath($_GET['file'])) { + printDocFunc($funcdeclared); + } + } +} + +/** outputs an HTML representation of the API doc of the class called $cname */ +function printAPIDocClass($cname, $documented = true) { + $res = ''; + $cdeclared = new ReflectionClass($cname); + //if ($cdeclared->getFileName()!=realpath($_GET['file'])) {continue;} + $res .= ''.$cdeclared->getName().' '; + $comment = trim(substr($cdeclared->getDocComment(),3,-2)); + if ($documented && strlen($comment)<1) { return '';} + $res .= printGk($comment); + foreach($cdeclared->getMethods() as $method) { + $f = printDocFuncObj($method, "      "/*,$cname.'.'*/, true); + if (strlen($f)>0) { + $res .= $f; + } + } + return "
".$res."

"; +} + +function getCodeSnippetsInClass($cname) { + $res = array(); + $cdeclared = new ReflectionClass($cname); + $res[] = _getCodeSnippet($cdeclared); + foreach($cdeclared->getMethods() as $method) { + $res[] = _getCodeSnippet($method); + } + return $res; +} + +/** returns the snippet of a function */ +function getCodeSnippet($function_name) { + $funcdeclared = new ReflectionFunction($function_name); + return _getCodeSnippet($funcdeclared); +} + + +function _getCodeSnippet($obj) { + $comment = getComment($obj); + if (preg_match('/
(.*)<\/pre>/is', $comment, $matches)) {
+      return $matches[1];
+  }  
+  return "";  
+}
+
+
+function getAllSnippetsInFile($file) {
+  $res = array();
+  foreach (get_functions_in($file) as $f) {
+    $x=getCodeSnippet($f);
+    if (strlen($x)>0) $res[] = $x;
+  }
+
+  foreach (get_classes_in($file) as $klass) {
+    foreach (getCodeSnippetsInClass($klass) as $x) {
+      if (strlen($x)>0)  $res[] = $x;
+    }
+  }
+  return $res;
+}
+
+
+
+
+?>

From 4cebac00aec41f0fefe583e225e76968347eeace Mon Sep 17 00:00:00 2001
From: Chris 
Date: Wed, 31 Jan 2018 22:09:02 -0500
Subject: [PATCH 12/14] bump

---
 .travis.yml                  |   2 +
 tests/bibtexbrowser-test.php |   2 +-
 tests/reflectivedoc.php      | 718 -----------------------------------
 3 files changed, 3 insertions(+), 719 deletions(-)
 delete mode 100644 tests/reflectivedoc.php

diff --git a/.travis.yml b/.travis.yml
index 11abd61..3fe911b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,6 +10,8 @@ php:
 script:
     - curl -L -o reflectivedoc.php https://www.monperrus.net/martin/reflectivedoc.php.txt
     - curl -L -o gakowiki-syntax.php https://www.monperrus.net/martin/gakowiki-syntax.php.txt
+    - cp ./src/bibtexbrowser.php ./tests/
+    - cp ./src/bibacid-utf8.bib ./tests/
     - phpunit tests/bibtexbrowser-test.php
 
 sudo: false
diff --git a/tests/bibtexbrowser-test.php b/tests/bibtexbrowser-test.php
index a8728f1..fb7f367 100755
--- a/tests/bibtexbrowser-test.php
+++ b/tests/bibtexbrowser-test.php
@@ -40,7 +40,7 @@ if (!is_file('reflectivedoc.php')) {
 }
 require('reflectivedoc.php');
 $nsnippet=0;
-foreach(getAllSnippetsInFile('../src/bibtexbrowser.php') as $snippet) {
+foreach(getAllSnippetsInFile('bibtexbrowser.php') as $snippet) {
     ob_start();
     eval($snippet);
     ob_get_clean();
diff --git a/tests/reflectivedoc.php b/tests/reflectivedoc.php
deleted file mode 100644
index 99d3c23..0000000
--- a/tests/reflectivedoc.php
+++ /dev/null
@@ -1,718 +0,0 @@
-parse($text);
-}
-
-
-?>\n different
-
- */
-
-if (defined('gakoparser.php')) return;
-define('gakoparser.php',true);
-
-class Delimiter{}
-
-class GakoParserException extends Exception {}
-
-/** provides a parametrizable parser. The main method is "parse" */
-class GakoParser {
-  
-  /** is the PHP5 constructor. */
-  function __construct() {
-    // an array of Delimiter objects
-    $this->start_delimiters = array();
-    $this->end_delimiters = array();
-    $this->nonesting = array();
-    $this->delegate = array();
-  }
-  
-  /** specifies that $tag can not contain nested tags */
-  function noNesting($tag) {
-    $this->nonesting[] = $tag;
-    return $this;
-  }
-
-  function setDelegate($obj) {
-    $this->delegate = $obj;
-    return $this;
-  }
-
-  function addDelim($name, $delim) {
-    return $this->addDelimX($name, $delim, $delim);
-  }
-
-  /** adds a trigger $tag -> execution of function $name */
-  function addTag($name, $tag) {
-    $start = substr($tag,0,strlen($tag)-1);
-    $end = substr($tag,strlen($tag)-1);
-    return $this->addDelimX($name, $start, $end);
-  }
-
-  /** setDelegate must be called before this method */
-  function addDelimX($name, $start, $end) {
-    if (!method_exists($this->delegate,$name)) {throw new GakoParserException('no method '.$method.' in delegate!');}
-
-    $x = new Delimiter();
-    $x->value = $start;
-//     $x->type = 'start';
-    $x->action = $name;
-    
-    $y = new Delimiter();
-    $y->value = $end;
-//     $y->type = 'end';
-    $y->action = $name;
-    
-    // crossing links
-    $y->startDelim = $x;
-    $x->endDelim = $y;
-    
-    if (in_array($start, $this->get_start_delimiters())) {
-      throw new GakoParserException("delimiter ".$start." already exists");
-    }
-    
-    $this->start_delimiters[$start] = $x;
-    $this->end_delimiters[$end] = $y;
-    return $this;
-  }
-
-  function get_start_delimiters() {
-    return array_keys($this->start_delimiters);
-  }
-  
-  function get_end_delimiters() {
-    return array_keys($this->end_delimiters);
-  }
-  
-  function array_preg_quote($x) {
-    $result = array();
-    foreach($x as $k) { $result[] = preg_quote($k, '/'); }
-    return $result;
-  }
-  
-  function addDelimXML($name, $delim) {
-    return $this->addDelimX($name, '<'.$delim.'>', '');
-  }
-
-  function getCandidateDelimiters_man($str) {
-    $result = array();
-    
-    for ( $i=0; $i < strlen( $str ); $i++) { 
-      foreach(array_merge($this->get_start_delimiters(),$this->get_end_delimiters()) as $v) {
-        $new_fragment = substr($str, $i, strlen($v));
-        if ($new_fragment === $v) {
-          $x = array();
-          $x[0] = array();
-          $x[0][0] = $v;
-          $x[0][1] = $i;
-          $result[] = $x;
-        }
-      }
-    }
-    //print_r($result);
-    return $result;
-  }
-
-  function getCandidateDelimiters($str) {
-    //return $this->getCandidateDelimiters_man($str);
-    return $this->getCandidateDelimiters_preg($str);
-  }
-
-  function getCandidateDelimiters_preg($str) {
-    // getting the start delimiters
-    preg_match_all('/'.implode('|',array_merge($this->array_preg_quote($this->get_start_delimiters()),$this->array_preg_quote($this->get_end_delimiters()))).'/', $str, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE );
-    return $matches;
-  }
-  
-  function parse($str) {
-//     echo "---------parse $str\n";
-    $method = '__pre';
-    if (method_exists($this->delegate,$method)) {
-      $str = $this->delegate->$method($str);
-    }
-    
-    $matches = $this->getCandidateDelimiters($str); 
-
-//     print_r($matches);
-    
-    //echo 'parse '.$str.'
'; - // the stack contains the current markup environment - $init = new Delimiter(); $init->action = '__init__'; $init->value = '__init__'; $init->endDelim = $init; - $stack = array($init); - $strings = array(1=>''); - $last = 0; - -// if (count($matches) == 0) return $str; - -// print_r($matches); - -// $strings[1] = substr($str, 0, $matches[0][0][1]); - - // for each tags found - foreach ( $matches as $_ ) { - - list($v, $pos) = $_[0]; - -// echo "studying ".$v." at ".$pos." (last=".$last.")\n"; - - // if $_ is a start delimiter, - // we'll get '' in $k - //echo $stack[0]; - if (isset($this->end_delimiters[$v]) -// && $stack[0] != '__init__' - && $stack[0]->endDelim->value == $v - && $pos>=$last - ) { - $k = $stack[0]->endDelim->action; - - $strings[count($stack)] .= substr($str,$last, $pos-$last); - -// echo "popping ".$k." at ".$pos." with ".$v." (last=".$last.", stack=".count($stack).")\n"; - - $closedtag = array_shift($stack); - - $method = $k; -// echo $method." ".$value. "\n"; - $value = $strings[count($stack)+1]; - $transformed = $this->delegate->$method($value); -// echo $transformed ."---".$value." \n"; - $strings[count($stack)] .= $transformed; - - $strings[count($stack)+1] = ''; - $last = $pos+strlen($v); - - } - - // certain tags do not support nesting - else if (!in_array($stack[0]->action, $this->nonesting) - && in_array($v, $this->get_start_delimiters()) && $pos >= $last) - { - $delim = $this->start_delimiters[$v]; - $k = $delim->action; - -// echo "putting ".$k." at ".$pos." with ".$last."
\n"; - - if ($pos>$last) { - $strings[count($stack)] .= substr($str, $last, $pos-$last); - } - array_unshift($stack, $delim); - // init the new stack - $strings[count($stack)] = ''; - $last = $pos+strlen($v); -// print_r($strings); - - } else { - //die('oops'); - } - - } // end foreach - - - if ($stack[0]->action!="__init__") { - //print_r($strings); - throw new GakoParserException("parsing error: ending with ".$stack[0]->action. " ('".$strings[1]."')"); - } - - $result = $strings[count($stack)]; - - // adding the rest - if ($lastdelegate,$method)) { - $result = $this->delegate->$method($result); - } - //echo "$$$$$ ".$result."\n"; - - return $result; - - } -} - - -?> - -// high level -$parser = create_wiki_parser(); -$html_text = $parser->parse($wiki_text); - -// low level - $parser = new Gakoparser(); - $parser->setDelegate(new MarkupInterpreter()); - $parser->addDelim('bold','**'); - echo $parser->parse('hello **world**'); - -
- */ - - -class GakowikiMarkupToHTMLTranslator { - - var $toc = array(); - - var $references = array(); - - /** replaces all line breaks by "__newline__" that are meant to replaced back by a call to __post() */ - function __pre($str) { - $result = $str; - - // we often use nelines to have pretty HTML code - // such as in tables - // however, they are no "real" newlines to be transformed in
- $result = preg_replace("/>\s*(\n|\r\n)/",'>__newline__',$result); - return $result; - } - - function bib($str) { - $this->references[] = $str; - return '['.count($this->references).'] '.$str; - } - - function cite($str) { - return "@@@".$str."@@@"; - } - - function escape_newline($str) { - return preg_replace("/(\n|\r\n)/","__newline__",$str); - } - - function toc($str) { - return '+++TOC+++'; - } - - function __post($str) { - $result = $str; - $result = preg_replace("/(\n|\r\n)/","
\n",$result); - - // workaround to support the semantics change in pre mode - // and the semantics of embedded HTML - $result = preg_replace("/__newline__/","\n",$result);// must be at the end - - // cleaning the additional
- // this is really nice - $result = preg_replace("/(<\/h.>)/i","\\1 ",$result); - - // adding the table of contents - $result = str_replace($this->toc(''),implode('
',$this->toc),$result); - - // adding the references - $citeregexp = '/@@@(.*?)@@@/'; - if (preg_match_all($citeregexp,$result,$matches)) { - foreach($matches[1] as $m) { - $theref = ''; - foreach ($this->references as $k => $ref) { - if (preg_match('/'.preg_quote($m).'/i', $ref)) { -//echo $m.' '.$ref; - // if we have already a match it is not deterministic - if ($theref!='') $result = "undeterministic citation: ".$m; - $theref = $ref; - $result = preg_replace('/@@@'.preg_quote($m).'@@@/i', '['.($k+1).']', $result); - } - } - } - } - - return $result; - } - - /** adds
 tags and prevents newline to be replaced by 
by __post */ - function pre($str) { - return '
'.$this->escape_newline($str).'
'; - } - - /** prevents newline to be replaced by
by __post */ - function unwrap($str) { - return $this->escape_newline($str); - } - - /** adds tags */ - function bold($str) { - return ''.$str.''; - } - - /** adds tags */ - function italic($str) { - return ''.$str.''; - } - - function table($str) { - $result = ''; - foreach(preg_split('/\n/',$str) as $line) { - if (strlen(trim($line))>0) { - $result .= ''; - foreach(preg_split('/&&/',$line) as $field) { - $result .= ''.$field.''; - - } - $result .= ''; - } - } - - return ''.$result.'
'; - } - - - function __create_anchor($m) { - return preg_replace("/[^a-zA-Z]/","",$m); - } - function h2($str) { - $tag = $this->__create_anchor($str); - $this->toc[] = "".$str.""; - return ''.'

'.$str."

"; - } - - function h3($str) { - $tag = $this->__create_anchor($str); - $this->toc[] = "  ".$str.""; - return ''.'

'.$str."

"; - } - - function monotype($str) { - return ''.str_replace('<','<',$str).''; - } - - function link($str) { - - if (preg_match('/(.*)\|(.*)/',$str, $matches)) { - $rawurl = $matches[1]; - $text = $matches[2]; - } else {$rawurl=$str;$text=$str;} - - $url=$rawurl; - - if (!preg_match("/(#|^http|^mailto)/",$rawurl)) { - if (function_exists('logical2url')) { - $url=logical2url($rawurl); - } else { - $url=$rawurl; - - } - } - - return ''.trim($text).''; - } - - function phpcode($str) { - ob_start(); - eval($str); - return $this->escape_newline(ob_get_clean()); - } - - function phpcode2($str) { - return gk_wiki2html($this->phpcode($str)); - } - - function a($str) { - return ''; - } - - function script($str) { - return 'escape_newline($str).''; - } - - function img($str) { - return ''; - } - - function img2($str) { - return ''; - } - - - function html($str) { - return '<'.$str.'>'; - } - - function iframe($str) { - return ''; - } - - - function comment($str) { - return ''; // comments are discarded - } - - function silent($str) { - return ''; - } - -} // end class - - -/** returns a parser object to parse wiki syntax. - -The returned object may be used with the parse method: -
-$parser = create_wiki_parser();
-$html_text = $parser->parse($wiki_text);
-
-*/ -function create_wiki_parser() { - $x = new Gakoparser(); - return $x->setDelegate(new GakowikiMarkupToHTMLTranslator()) - ->addDelimX('comment','')->noNesting('comment') - - ->addDelim('bold','**') - ->addDelim('italic','//')//->noNesting('italic') - ->addDelim('bold',"'''") - ->addDelim('monotype',"''")->noNesting('monotype') - ->addDelim('h2',"=====") // the longest comes before, it has the highest priority - ->addDelim('h3',"====") - ->addDelim('table',"|||") - ->addDelimXML('pre','pre')->noNesting('pre') // this is essential otherwise you have infinite loops - ->addDelimX('pre','{{{','}}}')->noNesting('pre2') // à la Google Code wiki syntax - ->addDelimX('link','[[',']]')->noNesting('link') - ->addDelimX('phpcode2','')->noNesting('phpcode2') - ->addDelimX('phpcode','') ->noNesting('phpcode') - ->addDelimX('img2','')->noNesting('img2') - ->addDelim('img','%%')->noNesting('img')// huge bug when I did this for 1000 index :( - ->addDelimX('script','') ->noNesting('script') - ->addDelimX('unwrap','^^','^^') - ->addTag('toc','+++TOC+++') - - ->addDelimX('a','')->noNesting('a') // important to support cross tags - - ->addDelimX('iframe','')->noNesting('iframe') - - // Dec 30 2012 - ->addDelimX('bib','\bib{','}') - ->addDelimX('cite','\cite{','}') - - // this one is really not good - //->addDelimX('html','<','>')->noNesting('html') // a link often contains // (e.g. http:// which clash with italics - ; -} // end create_wiki_parser - -function gakowiki__doc() { -?> -Syntax specification:
-**this is bold**
-//this is italic//
-''this is code''
-[[link to a page on this wiki]],[[http://www.google.fr|link to google]]
-

=====Section=====

-

====Subsection====

-', $result); - $result = str_replace('</pre>', '
', $result); - // removes lines prefixed "*" often used to have nice API comments - $result = preg_replace('/^.*?\*/m', '', $result); - return '
'.$result.'
'; - //return gk_wiki2html($comment); - } catch (GakoParserException $e) {return '
'.$comment.'
';} -} - -/** outputs the API doc of the function called $fname */ -function printDocFuncName($fname, $prefix='') { - $funcdeclared = new ReflectionFunction($fname); - return printDocFuncObj($funcdeclared, $prefix); -} - -function getComment($funcdeclared) { - $comment = trim(substr($funcdeclared->getDocComment(),3,-2)); - return $comment; -} -function printDocFuncObj($funcdeclared, $prefix='', $documented = true) { - $comment = trim(substr($funcdeclared->getDocComment(),3,-2)); - if ($documented && strlen($comment)<1) { return ''; } - $res = ""; - $res .= '
'; - $res .= ''.$prefix.$funcdeclared->getName().''; - $res .= '('.implode(', ',array_map('f',$funcdeclared->getParameters())).') '; - $res .= printGk($comment); - $res .= '
'; - return $res; -} - -// Anonymous functions are available only since PHP 5.3.0 -function f($x){return '$'.$x->getName();} - - -/** this is printNewFunctions - the main limitation is that this does not fully work if there is an exit/die in the included script -*/ -function printNewFunctions($beforef) { - $afterf=get_defined_functions(); - - - foreach($afterf['user'] as $fname ) { - $funcdeclared = new ReflectionFunction($fname); - if (!in_array($fname,$beforef['user']) && $funcdeclared->getFileName()==realpath($_GET['file'])) { - printDocFunc($funcdeclared); - } - } -} - -/** outputs an HTML representation of the API doc of the class called $cname */ -function printAPIDocClass($cname, $documented = true) { - $res = ''; - $cdeclared = new ReflectionClass($cname); - //if ($cdeclared->getFileName()!=realpath($_GET['file'])) {continue;} - $res .= ''.$cdeclared->getName().' '; - $comment = trim(substr($cdeclared->getDocComment(),3,-2)); - if ($documented && strlen($comment)<1) { return '';} - $res .= printGk($comment); - foreach($cdeclared->getMethods() as $method) { - $f = printDocFuncObj($method, "      "/*,$cname.'.'*/, true); - if (strlen($f)>0) { - $res .= $f; - } - } - return "
".$res."

"; -} - -function getCodeSnippetsInClass($cname) { - $res = array(); - $cdeclared = new ReflectionClass($cname); - $res[] = _getCodeSnippet($cdeclared); - foreach($cdeclared->getMethods() as $method) { - $res[] = _getCodeSnippet($method); - } - return $res; -} - -/** returns the snippet of a function */ -function getCodeSnippet($function_name) { - $funcdeclared = new ReflectionFunction($function_name); - return _getCodeSnippet($funcdeclared); -} - - -function _getCodeSnippet($obj) { - $comment = getComment($obj); - if (preg_match('/
(.*)<\/pre>/is', $comment, $matches)) {
-      return $matches[1];
-  }  
-  return "";  
-}
-
-
-function getAllSnippetsInFile($file) {
-  $res = array();
-  foreach (get_functions_in($file) as $f) {
-    $x=getCodeSnippet($f);
-    if (strlen($x)>0) $res[] = $x;
-  }
-
-  foreach (get_classes_in($file) as $klass) {
-    foreach (getCodeSnippetsInClass($klass) as $x) {
-      if (strlen($x)>0)  $res[] = $x;
-    }
-  }
-  return $res;
-}
-
-
-
-
-?>

From ab10bb500ee8060570c13b386f8a5171e024c9db Mon Sep 17 00:00:00 2001
From: Chris 
Date: Wed, 31 Jan 2018 23:59:40 -0500
Subject: [PATCH 13/14] breaking classes into files ala PSR4

---
 src/BibDBBuilder.php           | 161 ++++++++++++
 src/Definitions.php            | 374 +++++++++++++-------------
 src/ParserDelegate.php         |  27 ++
 src/StateBasedBibtexParser.php | 235 +++++++++++++++++
 src/StringEntry.php            |  19 ++
 src/XMLPrettyPrinter.php       |  40 +++
 src/bibtexbrowser.php          | 467 +--------------------------------
 7 files changed, 678 insertions(+), 645 deletions(-)
 create mode 100644 src/BibDBBuilder.php
 create mode 100644 src/ParserDelegate.php
 create mode 100644 src/StateBasedBibtexParser.php
 create mode 100644 src/StringEntry.php
 create mode 100644 src/XMLPrettyPrinter.php
 mode change 100755 => 100644 src/bibtexbrowser.php

diff --git a/src/BibDBBuilder.php b/src/BibDBBuilder.php
new file mode 100644
index 0000000..3939734
--- /dev/null
+++ b/src/BibDBBuilder.php
@@ -0,0 +1,161 @@
+
+    $empty_array = array();
+    $db = new BibDBBuilder(); // see also factory method createBibDBBuilder
+    $db->build('bibacid-utf8.bib'); // parses bib file
+    print_r($db->builtdb);// an associated array key -> BibEntry objects
+    print_r($db->stringdb);// an associated array key -> strings representing @string
+    
+ notes: + method build can be used several times, bibtex entries are accumulated in the builder +*/ +class BibDBBuilder extends ParserDelegate { + + /** A hashtable from keys to bib entries (BibEntry). */ + var $builtdb = array(); + + /** A hashtable of constant strings */ + var $stringdb = array(); + + var $filename; + + var $currentEntry; + + function build($bibfilename, $handle = NULL) { + + $this->filename = $bibfilename; + if ($handle == NULL) { + $handle = fopen($bibfilename, "r"); + } + + if (!$handle) die ('cannot open '.$bibfilename); + + $parser = new StateBasedBibtexParser($this); + $parser->parse($handle); + fclose($handle); + //print_r(array_keys($this->builtdb)); + //print_r($this->builtdb); + } + + + function getBuiltDb() { + //print_r($this->builtdb); + return $this->builtdb; + } + + function beginFile() { + } + + function endFile() { + // resolving crossrefs + // we are careful with PHP 4 semantics + foreach (array_keys($this->builtdb) as $key) { + $bib = $this->builtdb[$key]; + if ($bib->hasField('crossref')) { + if (isset($this->builtdb[$bib->getField('crossref')])) { + $crossrefEntry = $this->builtdb[$bib->getField('crossref')]; + $bib->crossref = $crossrefEntry; + foreach($crossrefEntry->getFields() as $k => $v) { + // copying the fields of the cross ref + // only if they don't exist yet + if (!$bib->hasField($k)) { + $bib->setField($k,$v); + } + } + } + } + } + //print_r($this->builtdb); + } + + function setEntryField($fieldkey,$entryvalue) { + $fieldkey=trim($fieldkey); + // support for Bibtex concatenation + // see http://newton.ex.ac.uk/tex/pack/bibtex/btxdoc/node3.html + // (?$v) { + // spaces are allowed when using # and they are not taken into account + // however # is not itself replaced by a space + // warning: @strings are not case sensitive + // see http://newton.ex.ac.uk/tex/pack/bibtex/btxdoc/node3.html + $stringKey=strtolower(trim($v)); + if (isset($this->stringdb[$stringKey])) + { + // this field will be formated later by xtrim and latex2html + $entryvalue_array[$k]=$this->stringdb[$stringKey]->value; + + // we keep a trace of this replacement + // so as to produce correct bibtex snippets + $this->currentEntry->constants[$stringKey]=$this->stringdb[$stringKey]->value; + } + } + $entryvalue=implode('',$entryvalue_array); + + $this->currentEntry->setField($fieldkey,$entryvalue); + } + + function setEntryType($entrytype) { + $this->currentEntry->setType($entrytype); + } + + function setEntryKey($entrykey) { + //echo "new entry:".$entrykey."\n"; + $this->currentEntry->setKey($entrykey); + } + + function beginEntry() { + $this->currentEntry = createBibEntry(); + $this->currentEntry->setFile($this->filename); + } + + function endEntry($entrysource) { + + // we add a timestamp + $this->currentEntry->timestamp(); + + // we add a key if there is no key + if (!$this->currentEntry->hasField(Q_KEY) && $this->currentEntry->getType()!='string') { + $this->currentEntry->setField(Q_KEY,md5($entrysource)); + } + + // we set the fulltext + $this->currentEntry->text = $entrysource; + + // we format the author names in a special field + // to enable search + if ($this->currentEntry->hasField('author')) { + $this->currentEntry->setField(Q_INNER_AUTHOR,$this->currentEntry->getFormattedAuthorsString()); + + foreach($this->currentEntry->getCanonicalAuthors() as $author) { + $homepage_key = $this->currentEntry->getHomePageKey($author); + if (isset($this->stringdb[$homepage_key])) { + $this->currentEntry->homepages[$homepage_key] = $this->stringdb[$homepage_key]->value; + } + } + } + + // ignoring jabref comments + if (($this->currentEntry->getType()=='comment')) { + /* do nothing for jabref comments */ + } + + // we add it to the string database + else if ($this->currentEntry->getType()=='string') { + foreach($this->currentEntry->fields as $k => $v) { + $k!=Q_INNER_TYPE and $this->stringdb[$k] = new StringEntry($k,$v,$this->filename); + } + } + + // we add it to the database + else { + $this->builtdb[$this->currentEntry->getKey()] = $this->currentEntry; + } + } + +} // end class BibDBBuilder diff --git a/src/Definitions.php b/src/Definitions.php index 46506a5..65d8c9d 100644 --- a/src/Definitions.php +++ b/src/Definitions.php @@ -2,188 +2,194 @@ namespace Monperrus\BibtexBrowser; -// the encoding of your bibtex file -@define('BIBTEX_INPUT_ENCODING','UTF-8');//@define('BIBTEX_INPUT_ENCODING','iso-8859-1');//define('BIBTEX_INPUT_ENCODING','windows-1252'); -// the encoding of the HTML output -@define('OUTPUT_ENCODING','UTF-8'); - -// print a warning if deprecated variable is used -if (defined('ENCODING')) { - echo 'ENCODING has been replaced by BIBTEX_INPUT_ENCODING and OUTPUT_ENCODING'; +class Definitions +{ + public function __construct() + { + // the encoding of your bibtex file + @define('BIBTEX_INPUT_ENCODING','UTF-8');//@define('BIBTEX_INPUT_ENCODING','iso-8859-1');//define('BIBTEX_INPUT_ENCODING','windows-1252'); + // the encoding of the HTML output + @define('OUTPUT_ENCODING','UTF-8'); + + // print a warning if deprecated variable is used + if (defined('ENCODING')) { + echo 'ENCODING has been replaced by BIBTEX_INPUT_ENCODING and OUTPUT_ENCODING'; + } + + // number of bib items per page + // we use the same parameter 'num' as Google + @define('PAGE_SIZE',isset($_GET['num'])?(preg_match('/^\d+$/',$_GET['num'])?$_GET['num']:10000):14); + + // bibtexbrowser uses a small piece of Javascript to improve the user experience + // see http://en.wikipedia.org/wiki/Progressive_enhancement + // if you don't like it, you can be disable it by adding in bibtexbrowser.local.php + // @define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',false); + @define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',true); + @define('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');// this is the name of a function + @define('BIBLIOGRAPHYSECTIONS','DefaultBibliographySections');// this is the name of a function + @define('BIBLIOGRAPHYTITLE','DefaultBibliographyTitle');// this is the name of a function + + // shall we load MathJax to render math in $…$ in HTML? + @define('BIBTEXBROWSER_RENDER_MATH', true); + @define('MATHJAX_URI', '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML.js'); + + // the default jquery URI + @define('JQUERY_URI', '//code.jquery.com/jquery-1.5.1.min.js'); + + // can we load bibtex files on external servers? + @define('BIBTEXBROWSER_LOCAL_BIB_ONLY', true); + + // the default view in {SimpleDisplay,AcademicDisplay,RSSDisplay,BibtexDisplay} + @define('BIBTEXBROWSER_DEFAULT_DISPLAY','SimpleDisplay'); + + // the default template + @define('BIBTEXBROWSER_DEFAULT_TEMPLATE','HTMLTemplate'); + + // the target frame of menu links + @define('BIBTEXBROWSER_MENU_TARGET','main'); // might be define('BIBTEXBROWSER_MENU_TARGET','_self'); in bibtexbrowser.local.php + + @define('ABBRV_TYPE','index');// may be year/x-abbrv/key/none/index/keys-index + + // are robots allowed to crawl and index bibtexbrowser generated pages? + @define('BIBTEXBROWSER_ROBOTS_NOINDEX',false); + + //the default view in the "main" (right hand side) frame + @define('BIBTEXBROWSER_DEFAULT_FRAME','year=latest'); // year=latest,all and all valid bibtexbrowser queries + + // Wrapper to use when we are included by another script + @define('BIBTEXBROWSER_EMBEDDED_WRAPPER', 'NoWrapper'); + + // Main class to use + @define('BIBTEXBROWSER_MAIN', 'Dispatcher'); + + // default order functions + // Contract Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. + // can be @define('ORDER_FUNCTION','compare_bib_entry_by_title'); + // can be @define('ORDER_FUNCTION','compare_bib_entry_by_bibtex_order'); + @define('ORDER_FUNCTION','compare_bib_entry_by_year'); + @define('ORDER_FUNCTION_FINE','compare_bib_entry_by_month'); + + // only displaying the n newest entries + @define('BIBTEXBROWSER_NEWEST',5); + + @define('BIBTEXBROWSER_NO_DEFAULT', false); + + // BIBTEXBROWSER_LINK_STYLE defines which function to use to display the links of a bibtex entry + @define('BIBTEXBROWSER_LINK_STYLE','bib2links_default'); // can be 'nothing' (a function that does nothing) + + // do we add [bibtex] links ? + @define('BIBTEXBROWSER_BIBTEX_LINKS',true); + // do we add [pdf] links ? + @define('BIBTEXBROWSER_PDF_LINKS',true); + // do we add [doi] links ? + @define('BIBTEXBROWSER_DOI_LINKS',true); + // do we add [gsid] links (Google Scholar)? + @define('BIBTEXBROWSER_GSID_LINKS',true); + + // should pdf, doi, url, gsid links be opened in a new window? + @define('BIBTEXBROWSER_LINKS_TARGET','_self');// can be _blank (new window), _top (with frames) + + // should authors be linked to [none/homepage/resultpage] + // none: nothing + // their homepage if defined as @strings + // their publication lists according to this bibtex + @define('BIBTEXBROWSER_AUTHOR_LINKS','homepage'); + + // BIBTEXBROWSER_LAYOUT defines the HTML rendering layout of the produced HTML + // may be table/list/ordered_list/definition/none (for ,
    ,
    , nothing resp.). + // for list/ordered_list, the abbrevations are not taken into account (see ABBRV_TYPE) + // for ordered_list, the index is given by HTML directly (in increasing order) + @define('BIBTEXBROWSER_LAYOUT','table'); + + // should the original bibtex be displayed or a reconstructed one with filtering + // values: original/reconstructed + // warning, with reconstructed, the latex markup for accents/diacritics is lost + @define('BIBTEXBROWSER_BIBTEX_VIEW','original'); + // a list of fields that will not be shown in the bibtex view if BIBTEXBROWSER_BIBTEX_VIEW=reconstructed + @define('BIBTEXBROWSER_BIBTEX_VIEW_FILTEREDOUT','comment|note|file'); + + // should Latex macros be executed (e.g. \'e -> é + @define('BIBTEXBROWSER_USE_LATEX2HTML',true); + + // Which is the first html level that should be used in embedded mode? + @define('BIBTEXBROWSER_HTMLHEADINGLEVEL', 2); + + @define('BIBTEXBROWSER_ACADEMIC_TOC', false); + + @define('BIBTEXBROWSER_DEBUG',false); + + // how to print authors names? + // default => as in the bibtex file + // USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT = true => "Meyer, Herbert" + // USE_INITIALS_FOR_NAMES = true => "Meyer H" + // USE_FIRST_THEN_LAST => Herbert Meyer + @define('USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT',false);// output authors in a comma separated form, e.g. "Meyer, H"? + @define('USE_INITIALS_FOR_NAMES',false); // use only initials for all first names? + @define('USE_FIRST_THEN_LAST',false); // use only initials for all first names? + @define('FORCE_NAMELIST_SEPARATOR', ''); // if non-empty, use this to separate multiple names regardless of USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT + @define('LAST_AUTHOR_SEPARATOR',' and '); + + @define('TYPES_SIZE',10); // number of entry types per table + @define('YEAR_SIZE',20); // number of years per table + @define('AUTHORS_SIZE',30); // number of authors per table + @define('TAGS_SIZE',30); // number of keywords per table + @define('READLINE_LIMIT',1024); + @define('Q_YEAR', 'year'); + @define('Q_YEAR_PAGE', 'year_page'); + @define('Q_YEAR_INPRESS', 'in press'); + @define('Q_YEAR_ACCEPTED', 'accepted'); + @define('Q_YEAR_SUBMITTED', 'submitted'); + @define('Q_FILE', 'bib'); + @define('Q_AUTHOR', 'author'); + @define('Q_AUTHOR_PAGE', 'author_page'); + @define('Q_TAG', 'keywords'); + @define('Q_TAG_PAGE', 'keywords_page'); + @define('Q_TYPE', 'type');// used for queries + @define('Q_TYPE_PAGE', 'type_page'); + @define('Q_ALL', 'all'); + @define('Q_ENTRY', 'entry'); + @define('Q_KEY', 'key'); + @define('Q_KEYS', 'keys'); // filter entries using a url-encoded, JSON-encoded array of bibtex keys + @define('Q_SEARCH', 'search'); + @define('Q_EXCLUDE', 'exclude'); + @define('Q_RESULT', 'result'); + @define('Q_ACADEMIC', 'academic'); + @define('Q_DB', 'bibdb'); + @define('Q_LATEST', 'latest'); + @define('Q_RANGE', 'range'); + @define('AUTHOR', 'author'); + @define('EDITOR', 'editor'); + @define('SCHOOL', 'school'); + @define('TITLE', 'title'); + @define('BOOKTITLE', 'booktitle'); + @define('YEAR', 'year'); + @define('BUFFERSIZE',100000); + @define('MULTIPLE_BIB_SEPARATOR',';'); + @define('METADATA_GS',true); + @define('METADATA_DC',true); + @define('METADATA_OPENGRAPH',true); + @define('METADATA_EPRINTS',false); + + // define sort order for special values in 'year' field + // highest number is sorted first + // don't exceed 0 though, since the values are added to PHP_INT_MAX + @define('ORDER_YEAR_INPRESS', -0); + @define('ORDER_YEAR_ACCEPTED', -1); + @define('ORDER_YEAR_SUBMITTED', -2); + @define('ORDER_YEAR_OTHERNONINT', -3); + + + // in embedded mode, we still need a URL for displaying bibtex entries alone + // this is usually resolved to bibtexbrowser.php + // but can be overridden in bibtexbrowser.local.php + // for instance with @define('BIBTEXBROWSER_URL',''); // links to the current page with ? + //@define('BIBTEXBROWSER_URL',basename(__FILE__)); + @define('BIBTEXBROWSER_URL',parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); + + // *************** END CONFIGURATION + + define('Q_INNER_AUTHOR', '_author');// internally used for representing the author + define('Q_INNER_TYPE', 'x-bibtex-type');// used for representing the type of the bibtex entry internally + @define('Q_INNER_KEYS_INDEX', '_keys-index');// used for storing indices in $_GET[Q_KEYS] array + } } - -// number of bib items per page -// we use the same parameter 'num' as Google -@define('PAGE_SIZE',isset($_GET['num'])?(preg_match('/^\d+$/',$_GET['num'])?$_GET['num']:10000):14); - -// bibtexbrowser uses a small piece of Javascript to improve the user experience -// see http://en.wikipedia.org/wiki/Progressive_enhancement -// if you don't like it, you can be disable it by adding in bibtexbrowser.local.php -// @define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',false); -@define('BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT',true); -@define('BIBLIOGRAPHYSTYLE','DefaultBibliographyStyle');// this is the name of a function -@define('BIBLIOGRAPHYSECTIONS','DefaultBibliographySections');// this is the name of a function -@define('BIBLIOGRAPHYTITLE','DefaultBibliographyTitle');// this is the name of a function - -// shall we load MathJax to render math in $…$ in HTML? -@define('BIBTEXBROWSER_RENDER_MATH', true); -@define('MATHJAX_URI', '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML.js'); - -// the default jquery URI -@define('JQUERY_URI', '//code.jquery.com/jquery-1.5.1.min.js'); - -// can we load bibtex files on external servers? -@define('BIBTEXBROWSER_LOCAL_BIB_ONLY', true); - -// the default view in {SimpleDisplay,AcademicDisplay,RSSDisplay,BibtexDisplay} -@define('BIBTEXBROWSER_DEFAULT_DISPLAY','SimpleDisplay'); - -// the default template -@define('BIBTEXBROWSER_DEFAULT_TEMPLATE','HTMLTemplate'); - -// the target frame of menu links -@define('BIBTEXBROWSER_MENU_TARGET','main'); // might be define('BIBTEXBROWSER_MENU_TARGET','_self'); in bibtexbrowser.local.php - -@define('ABBRV_TYPE','index');// may be year/x-abbrv/key/none/index/keys-index - -// are robots allowed to crawl and index bibtexbrowser generated pages? -@define('BIBTEXBROWSER_ROBOTS_NOINDEX',false); - -//the default view in the "main" (right hand side) frame -@define('BIBTEXBROWSER_DEFAULT_FRAME','year=latest'); // year=latest,all and all valid bibtexbrowser queries - -// Wrapper to use when we are included by another script -@define('BIBTEXBROWSER_EMBEDDED_WRAPPER', 'NoWrapper'); - -// Main class to use -@define('BIBTEXBROWSER_MAIN', 'Dispatcher'); - -// default order functions -// Contract Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. -// can be @define('ORDER_FUNCTION','compare_bib_entry_by_title'); -// can be @define('ORDER_FUNCTION','compare_bib_entry_by_bibtex_order'); -@define('ORDER_FUNCTION','compare_bib_entry_by_year'); -@define('ORDER_FUNCTION_FINE','compare_bib_entry_by_month'); - -// only displaying the n newest entries -@define('BIBTEXBROWSER_NEWEST',5); - -@define('BIBTEXBROWSER_NO_DEFAULT', false); - -// BIBTEXBROWSER_LINK_STYLE defines which function to use to display the links of a bibtex entry -@define('BIBTEXBROWSER_LINK_STYLE','bib2links_default'); // can be 'nothing' (a function that does nothing) - -// do we add [bibtex] links ? -@define('BIBTEXBROWSER_BIBTEX_LINKS',true); -// do we add [pdf] links ? -@define('BIBTEXBROWSER_PDF_LINKS',true); -// do we add [doi] links ? -@define('BIBTEXBROWSER_DOI_LINKS',true); -// do we add [gsid] links (Google Scholar)? -@define('BIBTEXBROWSER_GSID_LINKS',true); - -// should pdf, doi, url, gsid links be opened in a new window? -@define('BIBTEXBROWSER_LINKS_TARGET','_self');// can be _blank (new window), _top (with frames) - -// should authors be linked to [none/homepage/resultpage] -// none: nothing -// their homepage if defined as @strings -// their publication lists according to this bibtex -@define('BIBTEXBROWSER_AUTHOR_LINKS','homepage'); - -// BIBTEXBROWSER_LAYOUT defines the HTML rendering layout of the produced HTML -// may be table/list/ordered_list/definition/none (for
,
    ,
    , nothing resp.). -// for list/ordered_list, the abbrevations are not taken into account (see ABBRV_TYPE) -// for ordered_list, the index is given by HTML directly (in increasing order) -@define('BIBTEXBROWSER_LAYOUT','table'); - -// should the original bibtex be displayed or a reconstructed one with filtering -// values: original/reconstructed -// warning, with reconstructed, the latex markup for accents/diacritics is lost -@define('BIBTEXBROWSER_BIBTEX_VIEW','original'); -// a list of fields that will not be shown in the bibtex view if BIBTEXBROWSER_BIBTEX_VIEW=reconstructed -@define('BIBTEXBROWSER_BIBTEX_VIEW_FILTEREDOUT','comment|note|file'); - -// should Latex macros be executed (e.g. \'e -> é -@define('BIBTEXBROWSER_USE_LATEX2HTML',true); - -// Which is the first html level that should be used in embedded mode? -@define('BIBTEXBROWSER_HTMLHEADINGLEVEL', 2); - -@define('BIBTEXBROWSER_ACADEMIC_TOC', false); - -@define('BIBTEXBROWSER_DEBUG',false); - -// how to print authors names? -// default => as in the bibtex file -// USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT = true => "Meyer, Herbert" -// USE_INITIALS_FOR_NAMES = true => "Meyer H" -// USE_FIRST_THEN_LAST => Herbert Meyer -@define('USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT',false);// output authors in a comma separated form, e.g. "Meyer, H"? -@define('USE_INITIALS_FOR_NAMES',false); // use only initials for all first names? -@define('USE_FIRST_THEN_LAST',false); // use only initials for all first names? -@define('FORCE_NAMELIST_SEPARATOR', ''); // if non-empty, use this to separate multiple names regardless of USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT -@define('LAST_AUTHOR_SEPARATOR',' and '); - -@define('TYPES_SIZE',10); // number of entry types per table -@define('YEAR_SIZE',20); // number of years per table -@define('AUTHORS_SIZE',30); // number of authors per table -@define('TAGS_SIZE',30); // number of keywords per table -@define('READLINE_LIMIT',1024); -@define('Q_YEAR', 'year'); -@define('Q_YEAR_PAGE', 'year_page'); -@define('Q_YEAR_INPRESS', 'in press'); -@define('Q_YEAR_ACCEPTED', 'accepted'); -@define('Q_YEAR_SUBMITTED', 'submitted'); -@define('Q_FILE', 'bib'); -@define('Q_AUTHOR', 'author'); -@define('Q_AUTHOR_PAGE', 'author_page'); -@define('Q_TAG', 'keywords'); -@define('Q_TAG_PAGE', 'keywords_page'); -@define('Q_TYPE', 'type');// used for queries -@define('Q_TYPE_PAGE', 'type_page'); -@define('Q_ALL', 'all'); -@define('Q_ENTRY', 'entry'); -@define('Q_KEY', 'key'); -@define('Q_KEYS', 'keys'); // filter entries using a url-encoded, JSON-encoded array of bibtex keys -@define('Q_SEARCH', 'search'); -@define('Q_EXCLUDE', 'exclude'); -@define('Q_RESULT', 'result'); -@define('Q_ACADEMIC', 'academic'); -@define('Q_DB', 'bibdb'); -@define('Q_LATEST', 'latest'); -@define('Q_RANGE', 'range'); -@define('AUTHOR', 'author'); -@define('EDITOR', 'editor'); -@define('SCHOOL', 'school'); -@define('TITLE', 'title'); -@define('BOOKTITLE', 'booktitle'); -@define('YEAR', 'year'); -@define('BUFFERSIZE',100000); -@define('MULTIPLE_BIB_SEPARATOR',';'); -@define('METADATA_GS',true); -@define('METADATA_DC',true); -@define('METADATA_OPENGRAPH',true); -@define('METADATA_EPRINTS',false); - -// define sort order for special values in 'year' field -// highest number is sorted first -// don't exceed 0 though, since the values are added to PHP_INT_MAX -@define('ORDER_YEAR_INPRESS', -0); -@define('ORDER_YEAR_ACCEPTED', -1); -@define('ORDER_YEAR_SUBMITTED', -2); -@define('ORDER_YEAR_OTHERNONINT', -3); - - -// in embedded mode, we still need a URL for displaying bibtex entries alone -// this is usually resolved to bibtexbrowser.php -// but can be overridden in bibtexbrowser.local.php -// for instance with @define('BIBTEXBROWSER_URL',''); // links to the current page with ? -//@define('BIBTEXBROWSER_URL',basename(__FILE__)); -@define('BIBTEXBROWSER_URL',parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); - -// *************** END CONFIGURATION - -define('Q_INNER_AUTHOR', '_author');// internally used for representing the author -define('Q_INNER_TYPE', 'x-bibtex-type');// used for representing the type of the bibtex entry internally -@define('Q_INNER_KEYS_INDEX', '_keys-index');// used for storing indices in $_GET[Q_KEYS] array diff --git a/src/ParserDelegate.php b/src/ParserDelegate.php new file mode 100644 index 0000000..629af5d --- /dev/null +++ b/src/ParserDelegate.php @@ -0,0 +1,27 @@ +delegate = $delegate; + } + + public function parse($handle) { + if (gettype($handle) == 'string') { throw new Exception('oops'); } + $delegate = $this->delegate; + // STATE DEFINITIONS + @define('NOTHING',1); + @define('GETTYPE',2); + @define('GETKEY',3); + @define('GETVALUE',4); + @define('GETVALUEDELIMITEDBYQUOTES',5); + @define('GETVALUEDELIMITEDBYQUOTES_ESCAPED',6); + @define('GETVALUEDELIMITEDBYCURLYBRACKETS',7); + @define('GETVALUEDELIMITEDBYCURLYBRACKETS_ESCAPED',8); + @define('GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL',9); + @define('GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL_ESCAPED',10); + @define('GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL',11); + @define('GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL_ESCAPED',12); + @define('GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL',13); + @define('GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL_ESCAPED',14); + + + $state=NOTHING; + $entrytype=''; + $entrykey=''; + $entryvalue=''; + $fieldvaluepart=''; + $finalkey=''; + $entrysource=''; + + // metastate + $isinentry = false; + + $delegate->beginFile(); + + // if you encounter this error "Allowed memory size of xxxxx bytes exhausted" + // then decrease the size of the temp buffer below + $bufsize=BUFFERSIZE; + while (!feof($handle)) { + $sread=fread($handle,$bufsize); + //foreach(str_split($sread) as $s) { + for ( $i=0; $i < strlen( $sread ); $i++) { $s=$sread[$i]; + + if ($isinentry) $entrysource.=$s; + + if ($state==NOTHING) { + // this is the beginning of an entry + if ($s=='@') { + $delegate->beginEntry(); + $state = GETTYPE; + $isinentry = true; + $entrysource='@'; + } + } + + else if ($state==GETTYPE) { + // this is the beginning of a key + if ($s=='{') { + $state = GETKEY; + $delegate->setEntryType($entrytype); + $entrytype=''; + } + else $entrytype=$entrytype.$s; + } + + else if ($state==GETKEY) { + // now we get the value + if ($s=='=') { + $state = GETVALUE; + $fieldvaluepart=''; + $finalkey=$entrykey; + $entrykey=''; + } + // oups we only have the key :-) anyway + else if ($s=='}') { + $state = NOTHING;$isinentry = false;$delegate->endEntry($entrysource); + $entrykey=''; + } + // OK now we look for values + else if ($s==',') { + $state=GETKEY; + $delegate->setEntryKey($entrykey); + $entrykey='';} + else { $entrykey=$entrykey.$s; } + } + // we just got a =, we can now receive the value, but we don't now whether the value + // is delimited by curly brackets, double quotes or nothing + else if ($state==GETVALUE) { + + // the value is delimited by double quotes + if ($s=='"') { + $state = GETVALUEDELIMITEDBYQUOTES; + } + // the value is delimited by curly brackets + else if ($s=='{') { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS; + } + // the end of the key and no value found: it is the bibtex key e.g. \cite{Descartes1637} + else if ($s==',') { + $state = GETKEY; + $delegate->setEntryField($finalkey,$entryvalue); + $entryvalue=''; // resetting the value buffer + } + // this is the end of the value AND of the entry + else if ($s=='}') { + $state = NOTHING; + $delegate->setEntryField($finalkey,$entryvalue); + $isinentry = false;$delegate->endEntry($entrysource); + $entryvalue=''; // resetting the value buffer + } + else if ($s==' ' || $s=="\t" || $s=="\n" || $s=="\r" ) { + // blank characters are not taken into account when values are not in quotes or curly brackets + } + else { + $entryvalue=$entryvalue.$s; + } + } + + + /* GETVALUEDELIMITEDBYCURLYBRACKETS* handle entries delimited by curly brackets and the possible nested curly brackets */ + else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS) { + + if ($s=='\\') { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_ESCAPED; + $entryvalue=$entryvalue.$s;} + else if ($s=='{') { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL; + $entryvalue=$entryvalue.$s; + $delegate->entryValuePart($finalkey,$fieldvaluepart,'CURLYTOP'); + $fieldvaluepart=''; + } + else if ($s=='}') { // end entry + $state = GETVALUE; + $delegate->entryValuePart($finalkey,$fieldvaluepart,'CURLYTOP'); + } + else { + $entryvalue=$entryvalue.$s; + $fieldvaluepart=$fieldvaluepart.$s; + } + } + // handle anti-slashed brackets + else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_ESCAPED) { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS; + $entryvalue=$entryvalue.$s; + } + // in first level of curly bracket + else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL) { + if ($s=='\\') { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL_ESCAPED; + $entryvalue=$entryvalue.$s;} + else if ($s=='{') { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL;$entryvalue=$entryvalue.$s;} + else if ($s=='}') { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS; + $delegate->entryValuePart($finalkey,$fieldvaluepart,'CURLYONE'); + $fieldvaluepart=''; + $entryvalue=$entryvalue.$s; + } + else { + $entryvalue=$entryvalue.$s; + $fieldvaluepart=$fieldvaluepart.$s; + } + } + // handle anti-slashed brackets + else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL_ESCAPED) { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL; + $entryvalue=$entryvalue.$s; + } + + // in second level of curly bracket + else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL) { + if ($s=='\\') { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL_ESCAPED; + $entryvalue=$entryvalue.$s;} + else if ($s=='{') { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL;$entryvalue=$entryvalue.$s;} + else if ($s=='}') { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL;$entryvalue=$entryvalue.$s;} + else { $entryvalue=$entryvalue.$s;} + } + // handle anti-slashed brackets + else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL_ESCAPED) { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL; + $entryvalue=$entryvalue.$s; + } + + // in third level of curly bracket + else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL) { + if ($s=='\\') { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL_ESCAPED; + $entryvalue=$entryvalue.$s;} + else if ($s=='}') { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL;$entryvalue=$entryvalue.$s;} + else { $entryvalue=$entryvalue.$s;} + } + // handle anti-slashed brackets + else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL_ESCAPED) { + $state = GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL; + $entryvalue=$entryvalue.$s; + } + + /* handles entries delimited by double quotes */ + else if ($state==GETVALUEDELIMITEDBYQUOTES) { + + if ($s=='\\') { + $state = GETVALUEDELIMITEDBYQUOTES_ESCAPED; + $entryvalue=$entryvalue.$s;} + else if ($s=='"') { + $state = GETVALUE; + } + else { $entryvalue=$entryvalue.$s;} + } + // handle anti-double quotes + else if ($state==GETVALUEDELIMITEDBYQUOTES_ESCAPED) { + $state = GETVALUEDELIMITEDBYQUOTES; + $entryvalue=$entryvalue.$s; + } + + } // end for + } // end while + $delegate->endFile(); + //$d = $this->delegate;print_r($d); + } // end function +} // end class diff --git a/src/StringEntry.php b/src/StringEntry.php new file mode 100644 index 0000000..0f54186 --- /dev/null +++ b/src/StringEntry.php @@ -0,0 +1,19 @@ +name=$key; + $this->value=$value; + $this->filename=$filename; + } + + public function toString() + { + return '@string{'.$this->name.'={'.$this->value.'}}'; + } +} // end class StringEntry diff --git a/src/XMLPrettyPrinter.php b/src/XMLPrettyPrinter.php new file mode 100644 index 0000000..ce414f3 --- /dev/null +++ b/src/XMLPrettyPrinter.php @@ -0,0 +1,40 @@ +'; + print ''; + } + + public function endFile() { + print ''; + } + + public function setEntryField($finalkey,$entryvalue) { + print "\n".$finalkey."\n".$entryvalue."\n\n"; + } + + public function setEntryType($entrytype) { + print ''.$entrytype.''; + } + + public function setEntryKey($entrykey) { + print ''.$entrykey.''; + } + + public function beginEntry() { + print "\n"; + } + + public function endEntry($entrysource) { + print "\n"; + } +} // end class XMLPrettyPrinter diff --git a/src/bibtexbrowser.php b/src/bibtexbrowser.php old mode 100755 new mode 100644 index e3aae03..681d260 --- a/src/bibtexbrowser.php +++ b/src/bibtexbrowser.php @@ -15,6 +15,12 @@ License, or (at your option) any later version. */ +use Monperrus\BibtexBrowser\StateBasedBibtexParser; +use Monperrus\BibtexBrowser\ParserDelegate; +use Monperrus\BibtexBrowser\XMLPrettyPrinter; +use Monperrus\BibtexBrowser\StringEntry; +use Monperrus\BibtexBrowser\BibDBBuilder; + // it is be possible to include( 'bibtexbrowser.php' ); several times in the same script // added on Wednesday, June 01 2011, bug found by Carlos Bras if (!defined('BIBTEXBROWSER')) { @@ -483,471 +489,10 @@ notes: - It has no dependencies, it can be used outside of bibtexbrowser - The delegate is expected to have some methods, see classes BibDBBuilder and XMLPrettyPrinter */ -class StateBasedBibtexParser { - - var $delegate; - - function __construct($delegate) { - $this->delegate = $delegate; - } - - function parse($handle) { - if (gettype($handle) == 'string') { throw new Exception('oops'); } - $delegate = $this->delegate; - // STATE DEFINITIONS - @define('NOTHING',1); - @define('GETTYPE',2); - @define('GETKEY',3); - @define('GETVALUE',4); - @define('GETVALUEDELIMITEDBYQUOTES',5); - @define('GETVALUEDELIMITEDBYQUOTES_ESCAPED',6); - @define('GETVALUEDELIMITEDBYCURLYBRACKETS',7); - @define('GETVALUEDELIMITEDBYCURLYBRACKETS_ESCAPED',8); - @define('GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL',9); - @define('GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL_ESCAPED',10); - @define('GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL',11); - @define('GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL_ESCAPED',12); - @define('GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL',13); - @define('GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL_ESCAPED',14); - - - $state=NOTHING; - $entrytype=''; - $entrykey=''; - $entryvalue=''; - $fieldvaluepart=''; - $finalkey=''; - $entrysource=''; - - // metastate - $isinentry = false; - - $delegate->beginFile(); - - // if you encounter this error "Allowed memory size of xxxxx bytes exhausted" - // then decrease the size of the temp buffer below - $bufsize=BUFFERSIZE; - while (!feof($handle)) { - $sread=fread($handle,$bufsize); - //foreach(str_split($sread) as $s) { - for ( $i=0; $i < strlen( $sread ); $i++) { $s=$sread[$i]; - - if ($isinentry) $entrysource.=$s; - - if ($state==NOTHING) { - // this is the beginning of an entry - if ($s=='@') { - $delegate->beginEntry(); - $state = GETTYPE; - $isinentry = true; - $entrysource='@'; - } - } - - else if ($state==GETTYPE) { - // this is the beginning of a key - if ($s=='{') { - $state = GETKEY; - $delegate->setEntryType($entrytype); - $entrytype=''; - } - else $entrytype=$entrytype.$s; - } - - else if ($state==GETKEY) { - // now we get the value - if ($s=='=') { - $state = GETVALUE; - $fieldvaluepart=''; - $finalkey=$entrykey; - $entrykey=''; - } - // oups we only have the key :-) anyway - else if ($s=='}') { - $state = NOTHING;$isinentry = false;$delegate->endEntry($entrysource); - $entrykey=''; - } - // OK now we look for values - else if ($s==',') { - $state=GETKEY; - $delegate->setEntryKey($entrykey); - $entrykey='';} - else { $entrykey=$entrykey.$s; } - } - // we just got a =, we can now receive the value, but we don't now whether the value - // is delimited by curly brackets, double quotes or nothing - else if ($state==GETVALUE) { - - // the value is delimited by double quotes - if ($s=='"') { - $state = GETVALUEDELIMITEDBYQUOTES; - } - // the value is delimited by curly brackets - else if ($s=='{') { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS; - } - // the end of the key and no value found: it is the bibtex key e.g. \cite{Descartes1637} - else if ($s==',') { - $state = GETKEY; - $delegate->setEntryField($finalkey,$entryvalue); - $entryvalue=''; // resetting the value buffer - } - // this is the end of the value AND of the entry - else if ($s=='}') { - $state = NOTHING; - $delegate->setEntryField($finalkey,$entryvalue); - $isinentry = false;$delegate->endEntry($entrysource); - $entryvalue=''; // resetting the value buffer - } - else if ($s==' ' || $s=="\t" || $s=="\n" || $s=="\r" ) { - // blank characters are not taken into account when values are not in quotes or curly brackets - } - else { - $entryvalue=$entryvalue.$s; - } - } - - - /* GETVALUEDELIMITEDBYCURLYBRACKETS* handle entries delimited by curly brackets and the possible nested curly brackets */ - else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS) { - - if ($s=='\\') { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_ESCAPED; - $entryvalue=$entryvalue.$s;} - else if ($s=='{') { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL; - $entryvalue=$entryvalue.$s; - $delegate->entryValuePart($finalkey,$fieldvaluepart,'CURLYTOP'); - $fieldvaluepart=''; - } - else if ($s=='}') { // end entry - $state = GETVALUE; - $delegate->entryValuePart($finalkey,$fieldvaluepart,'CURLYTOP'); - } - else { - $entryvalue=$entryvalue.$s; - $fieldvaluepart=$fieldvaluepart.$s; - } - } - // handle anti-slashed brackets - else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_ESCAPED) { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS; - $entryvalue=$entryvalue.$s; - } - // in first level of curly bracket - else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL) { - if ($s=='\\') { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL_ESCAPED; - $entryvalue=$entryvalue.$s;} - else if ($s=='{') { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL;$entryvalue=$entryvalue.$s;} - else if ($s=='}') { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS; - $delegate->entryValuePart($finalkey,$fieldvaluepart,'CURLYONE'); - $fieldvaluepart=''; - $entryvalue=$entryvalue.$s; - } - else { - $entryvalue=$entryvalue.$s; - $fieldvaluepart=$fieldvaluepart.$s; - } - } - // handle anti-slashed brackets - else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL_ESCAPED) { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL; - $entryvalue=$entryvalue.$s; - } - - // in second level of curly bracket - else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL) { - if ($s=='\\') { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL_ESCAPED; - $entryvalue=$entryvalue.$s;} - else if ($s=='{') { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL;$entryvalue=$entryvalue.$s;} - else if ($s=='}') { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_1NESTEDLEVEL;$entryvalue=$entryvalue.$s;} - else { $entryvalue=$entryvalue.$s;} - } - // handle anti-slashed brackets - else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL_ESCAPED) { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL; - $entryvalue=$entryvalue.$s; - } - - // in third level of curly bracket - else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL) { - if ($s=='\\') { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL_ESCAPED; - $entryvalue=$entryvalue.$s;} - else if ($s=='}') { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_2NESTEDLEVEL;$entryvalue=$entryvalue.$s;} - else { $entryvalue=$entryvalue.$s;} - } - // handle anti-slashed brackets - else if ($state==GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL_ESCAPED) { - $state = GETVALUEDELIMITEDBYCURLYBRACKETS_3NESTEDLEVEL; - $entryvalue=$entryvalue.$s; - } - - /* handles entries delimited by double quotes */ - else if ($state==GETVALUEDELIMITEDBYQUOTES) { - - if ($s=='\\') { - $state = GETVALUEDELIMITEDBYQUOTES_ESCAPED; - $entryvalue=$entryvalue.$s;} - else if ($s=='"') { - $state = GETVALUE; - } - else { $entryvalue=$entryvalue.$s;} - } - // handle anti-double quotes - else if ($state==GETVALUEDELIMITEDBYQUOTES_ESCAPED) { - $state = GETVALUEDELIMITEDBYQUOTES; - $entryvalue=$entryvalue.$s; - } - - } // end for - } // end while - $delegate->endFile(); - //$d = $this->delegate;print_r($d); - } // end function -} // end class - -/** a default empty implementation of a delegate for StateBasedBibtexParser */ -class ParserDelegate { - - function beginFile() {} - - function endFile() {} - - function setEntryField($finalkey,$entryvalue) {} - - function setEntryType($entrytype) {} - - function setEntryKey($entrykey) {} - - function beginEntry() {} - - function endEntry($entrysource) {} - - /** called for each sub parts of type {part} of a field value - * for now, only CURLYTOP and CURLYONE events - */ - function entryValuePart($key, $value, $type) {} - -} // end class ParserDelegate - - -/** is a possible delegate for StateBasedBibParser. -usage: -see snippet of [[#StateBasedBibParser]] -*/ -class XMLPrettyPrinter extends ParserDelegate { - function beginFile() { - header('Content-type: text/xml;'); - print ''; - print ''; - } - - - function endFile() { - print ''; - } - function setEntryField($finalkey,$entryvalue) { - print "\n".$finalkey."\n".$entryvalue."\n\n"; - } - - function setEntryType($entrytype) { - print ''.$entrytype.''; - } - function setEntryKey($entrykey) { - print ''.$entrykey.''; - } - - function beginEntry() { - print "\n"; - } - - function endEntry($entrysource) { - print "\n"; - } -} // end class XMLPrettyPrinter - -/** represents @string{k=v} */ -class StringEntry { - function __construct($k, $v, $filename) { - $this->name=$k; - $this->value=$v; - $this->filename=$filename; - } - - function toString() { - return '@string{'.$this->name.'={'.$this->value.'}}'; - } -} // end class StringEntry - - - - -/** builds arrays of BibEntry objects from a bibtex file. -usage: -
    -  $empty_array = array();
    -  $db = new BibDBBuilder(); // see also factory method createBibDBBuilder
    -  $db->build('bibacid-utf8.bib'); // parses bib file
    -  print_r($db->builtdb);// an associated array key -> BibEntry objects
    -  print_r($db->stringdb);// an associated array key -> strings representing @string
    -
    -notes: - method build can be used several times, bibtex entries are accumulated in the builder -*/ -class BibDBBuilder extends ParserDelegate { - - /** A hashtable from keys to bib entries (BibEntry). */ - var $builtdb = array(); - - /** A hashtable of constant strings */ - var $stringdb = array(); - - var $filename; - - var $currentEntry; - - function build($bibfilename, $handle = NULL) { - - $this->filename = $bibfilename; - if ($handle == NULL) { - $handle = fopen($bibfilename, "r"); - } - - if (!$handle) die ('cannot open '.$bibfilename); - - $parser = new StateBasedBibtexParser($this); - $parser->parse($handle); - fclose($handle); - //print_r(array_keys($this->builtdb)); - //print_r($this->builtdb); - } - - - function getBuiltDb() { - //print_r($this->builtdb); - return $this->builtdb; - } - - function beginFile() { - } - - function endFile() { - // resolving crossrefs - // we are careful with PHP 4 semantics - foreach (array_keys($this->builtdb) as $key) { - $bib = $this->builtdb[$key]; - if ($bib->hasField('crossref')) { - if (isset($this->builtdb[$bib->getField('crossref')])) { - $crossrefEntry = $this->builtdb[$bib->getField('crossref')]; - $bib->crossref = $crossrefEntry; - foreach($crossrefEntry->getFields() as $k => $v) { - // copying the fields of the cross ref - // only if they don't exist yet - if (!$bib->hasField($k)) { - $bib->setField($k,$v); - } - } - } - } - } - //print_r($this->builtdb); - } - - function setEntryField($fieldkey,$entryvalue) { - $fieldkey=trim($fieldkey); - // support for Bibtex concatenation - // see http://newton.ex.ac.uk/tex/pack/bibtex/btxdoc/node3.html - // (?$v) { - // spaces are allowed when using # and they are not taken into account - // however # is not itself replaced by a space - // warning: @strings are not case sensitive - // see http://newton.ex.ac.uk/tex/pack/bibtex/btxdoc/node3.html - $stringKey=strtolower(trim($v)); - if (isset($this->stringdb[$stringKey])) - { - // this field will be formated later by xtrim and latex2html - $entryvalue_array[$k]=$this->stringdb[$stringKey]->value; - - // we keep a trace of this replacement - // so as to produce correct bibtex snippets - $this->currentEntry->constants[$stringKey]=$this->stringdb[$stringKey]->value; - } - } - $entryvalue=implode('',$entryvalue_array); - - $this->currentEntry->setField($fieldkey,$entryvalue); - } - - function setEntryType($entrytype) { - $this->currentEntry->setType($entrytype); - } - - function setEntryKey($entrykey) { - //echo "new entry:".$entrykey."\n"; - $this->currentEntry->setKey($entrykey); - } - - function beginEntry() { - $this->currentEntry = createBibEntry(); - $this->currentEntry->setFile($this->filename); - } - function endEntry($entrysource) { - // we add a timestamp - $this->currentEntry->timestamp(); - - // we add a key if there is no key - if (!$this->currentEntry->hasField(Q_KEY) && $this->currentEntry->getType()!='string') { - $this->currentEntry->setField(Q_KEY,md5($entrysource)); - } - - // we set the fulltext - $this->currentEntry->text = $entrysource; - - // we format the author names in a special field - // to enable search - if ($this->currentEntry->hasField('author')) { - $this->currentEntry->setField(Q_INNER_AUTHOR,$this->currentEntry->getFormattedAuthorsString()); - - foreach($this->currentEntry->getCanonicalAuthors() as $author) { - $homepage_key = $this->currentEntry->getHomePageKey($author); - if (isset($this->stringdb[$homepage_key])) { - $this->currentEntry->homepages[$homepage_key] = $this->stringdb[$homepage_key]->value; - } - } - } - - // ignoring jabref comments - if (($this->currentEntry->getType()=='comment')) { - /* do nothing for jabref comments */ - } - - // we add it to the string database - else if ($this->currentEntry->getType()=='string') { - foreach($this->currentEntry->fields as $k => $v) { - $k!=Q_INNER_TYPE and $this->stringdb[$k] = new StringEntry($k,$v,$this->filename); - } - } - - // we add it to the database - else { - $this->builtdb[$this->currentEntry->getKey()] = $this->currentEntry; - } - } -} // end class BibDBBuilder From b88da5c996f9a7e8f47993f54f56c4d31c82cbc5 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 1 Feb 2018 00:04:55 -0500 Subject: [PATCH 14/14] for now pinning required php version to 5.3 for need of namespacing --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b522c95..c0281b5 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "php": ">=4" + "php": ">=5.3.0" }, "autoload": { "psr-4": {