├── .jsbeautifyrc ├── .pre-commit.sh ├── .travis.yml ├── LICENSE ├── README.md ├── demo ├── FullDemo.html ├── InstallationDemo.html ├── acedemicstyle.html ├── bibtex.html ├── bibtex2.html └── test.bib ├── package.json ├── src └── bibtex_js.js ├── test ├── html │ ├── academicstyle.html │ ├── author_click_sort.html │ ├── authorformat.html │ ├── authors.bib │ ├── autogenerateselects.html │ ├── autogenerateselects_lastfirstinitial.html │ ├── autogenerateselects_sort.html │ ├── bibtexVar.html │ ├── bibtexkeys.html │ ├── bibtexvar_css_escape.html │ ├── callback.html │ ├── callback2.html │ ├── conjunction.html │ ├── conjunction_custom_author_list.html │ ├── conjunction_empty.html │ ├── conjunction_missing.html │ ├── firstinitials.html │ ├── group.html │ ├── groupCustomHeader.html │ ├── ifequals.html │ ├── max1authors.html │ ├── max2authors.html │ ├── maxauthors.bib │ ├── selectingbyauthor.html │ ├── selectingentries.html │ ├── simple.html │ ├── sort.html │ ├── sort_missing_date.html │ ├── sort_missing_year.html │ ├── testing.bib │ └── testing_partial_date_year.bib └── test.js └── wiki └── logo.png /.jsbeautifyrc: -------------------------------------------------------------------------------- 1 | { 2 | "indent_size": 4, 3 | "indent_char": " ", 4 | "indent_with_tabs": false, 5 | "eol": "\n", 6 | "end_with_newline": false, 7 | "indent_level": 0, 8 | "preserve_newlines": true, 9 | "max_preserve_newlines": 10, 10 | "space_in_paren": false, 11 | "space_in_empty_paren": false, 12 | "jslint_happy": false, 13 | "space_after_anon_function": false, 14 | "brace_style": "collapse", 15 | "unindent_chained_methods": false, 16 | "break_chained_methods": false, 17 | "keep_array_indentation": false, 18 | "unescape_strings": false, 19 | "wrap_line_length": 0, 20 | "e4x": false, 21 | "comma_first": false, 22 | "operator_position": "before-newline" 23 | } -------------------------------------------------------------------------------- /.pre-commit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | jsfiles=$(git diff --cached --diff-filter=dx --name-only HEAD | grep ".*\.js$") 3 | [ -z "$jsfiles" ] && exit 0 4 | 5 | if ! [ -x "$(command -v js-beautify)" ]; then 6 | echo 'Error: js-beautify is not installed.' >&2 7 | exit 1 8 | fi 9 | 10 | # temp commit of your staged changes: 11 | git commit --no-verify --message "WIP" 12 | 13 | # Stash unstaged changes 14 | STASH_NAME="pre-commit-$(date +%s)" 15 | git stash save -q --keep-index $STASH_NAME 16 | 17 | # now un-commit WIP commit: 18 | git reset --soft HEAD^ 19 | 20 | # js-beautify all the .js files 21 | for f in ${jsfiles[@]}; do 22 | js-beautify -r $f 23 | echo $f 24 | done 25 | 26 | # Stage updated files 27 | git add -u 28 | 29 | # Re-apply original unstaged changes 30 | if [[ $(git stash list -n 1 --grep $STASH_NAME) ]]; then 31 | git stash pop -q 32 | fi 33 | 34 | exit 0 35 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: "stable" 3 | 4 | before_install: 5 | - stty cols 80 6 | 7 | os: linux 8 | dist: trusty 9 | 10 | addons: 11 | firefox: latest 12 | chrome: stable 13 | apt: 14 | packages: 15 | - fluxbox 16 | 17 | before_script: 18 | - "export DISPLAY=:99.0" 19 | - "sh -e /etc/init.d/xvfb start" 20 | - sleep 3 21 | - fluxbox >/dev/null 2>&1 & 22 | - python -m SimpleHTTPServer & 23 | - sleep 2 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Philip Cooksey 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ![BibTeX-js](wiki/logo.png) # 2 | **[Install it on your website!](https://github.com/pcooksey/bibtex-js/wiki)** 3 | 4 | BibTeX-js can parse a BibTeX-file and render it as part of an HTML file. This way, you can easily add a list of publications to your private homepage or display a list of recommended publications for a seminar. The way the entries are display can be customized using a simple template system and CSS. 5 | 6 | * Fast parser written in pure javascript (parser is in O(n)) 7 | * No setup required, drop-in solution 8 | * Sorting and grouping 9 | * Search capability 10 | 11 | [Live Demo](http://www.cs.cmu.edu/~mmv/Veloso.html) 12 | 13 | [Forked from (c) 2010 Henrik Muehe. MIT License](https://code.google.com/p/bibtex-js/) 14 | 15 | | Branch | Build Status | 16 | | ------ | ------------ | 17 | | Master | [![Build Status](https://travis-ci.org/pcooksey/bibtex-js.svg?branch=master)](https://travis-ci.org/pcooksey/bibtex-js)| 18 | | Develop | [![Build Status](https://travis-ci.org/pcooksey/bibtex-js.svg?branch=develop)](https://travis-ci.org/pcooksey/bibtex-js) | 19 | -------------------------------------------------------------------------------- /demo/FullDemo.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Your Publications 9 | 10 | 11 | 12 | 13 | 14 | 15 | 35 | 36 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |

Your Publications

55 |
56 | 82 |
83 | 84 |
85 |
86 | (Top of the page) 87 |
88 |
89 |
90 |
91 |
92 |
93 | 94 |
95 | 96 | 128 | 129 |
130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /demo/InstallationDemo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /demo/acedemicstyle.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 31 | 32 |
33 |

Rendered Publications

34 | 35 |
36 | 37 |
38 |
39 |
40 |

Refereed Articles

41 |
42 |
43 |
44 |
45 |
46 |

Books

47 |
48 |
49 |
50 |
51 |
52 |

Conference and Workshop Papers

53 |
54 |
55 |
56 |
57 |
58 |

Other Publications

59 |
60 |
61 |
62 |
63 |
64 |
65 | 66 |
67 | 68 |
69 | 84 |
85 | 86 |
87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /demo/bibtex.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 20 | 21 | 22 | 23 |

BibTeX Input

24 | 260 |
261 | 262 |

Template

263 | 280 | 281 |

Rendered

282 | 283 |
284 |
285 | 300 |
301 |
302 | 303 | 330 | 331 | 332 | 333 | -------------------------------------------------------------------------------- /demo/bibtex2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 31 | 32 |
33 |

Rendered Publications

34 | 35 |
36 | 37 |
38 |
39 |
40 |
41 |
42 | 43 |
44 | 45 |
46 | 61 |
62 | 63 |
64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /demo/test.bib: -------------------------------------------------------------------------------- 1 | @book{sammet2003programming, 2 | title={{Programming languages}}, 3 | author={Sammet, J.E. and Hemmendinger, D.}, 4 | year={2003}, 5 | publisher={John Wiley and Sons Ltd.} 6 | }, 7 | 8 | @book{bauer1998ubersetzung, 9 | title={Übersetzung objektorientierter Programmiersprachen: Konzepte, abstrakte Maschinen und Praktikum \glqq Java Compiler\grqq}, 10 | author={Bauer, B. and Höllerer, R.}, 11 | year={1998}, 12 | publisher={Springer} 13 | } 14 | 15 | @article{parr1995antlr, 16 | title={{ANTLR: A predicated-LL (k) parser generator}}, 17 | author={Parr, T.J. and Quong, R.W.}, 18 | journal={Software-Practice and Experience}, 19 | volume={25}, 20 | number={7}, 21 | pages={789--810}, 22 | year={1995}, 23 | publisher={Citeseer} 24 | } 25 | 26 | @book{ginsburg1975algebraic, 27 | title={{Algebraic and automata-theoretic properties of formal languages}}, 28 | author={Ginsburg, S.}, 29 | year={1975}, 30 | publisher={Elsevier Science Inc. New York, NY, USA} 31 | } 32 | 33 | @misc{ wiki:chomskyh, 34 | author = "Wikipedia", 35 | title = "Chomsky-Hierarchie --- Wikipedia{,} Die freie Enzyklopädie", 36 | year = "2010", 37 | url = "\url{http://de.wikipedia.org/w/index.php?title=Chomsky-Hierarchie&oldid=71123007}", 38 | note = "[Online; Stand 11. März 2010]" 39 | } 40 | 41 | @misc{ wiki:ebnf, 42 | author = "Wikipedia", 43 | title = "Extended Backus-Naur Form --- Wikipedia{,} The Free Encyclopedia", 44 | year = "2010", 45 | url = "\url{http://en.wikipedia.org/w/index.php?title=Extended_Backus%E2%80%93Naur_Form&oldid=348946400}", 46 | note = "[Online; accessed 11-March-2010]" 47 | } 48 | 49 | 50 | 51 | @article{schning2001theoretische, 52 | title={{Theoretische Informatik kurzgefasst, 4}}, 53 | author={Schning, U.}, 54 | journal={Auflage. Spektrum-Verlag}, 55 | year={2001} 56 | } 57 | 58 | @book{grune2008parsing, 59 | title={{Parsing techniques: a practical guide}}, 60 | author={Grune, D. and Jacobs, C.J.H.}, 61 | year={2008}, 62 | publisher={Springer-Verlag New York Inc} 63 | } 64 | 65 | @misc{ wiki:pda, 66 | author = "Wikipedia", 67 | title = "Pushdown automaton --- Wikipedia{,} The Free Encyclopedia", 68 | year = "2010", 69 | url = "\url{http://en.wikipedia.org/w/index.php?title=Pushdown_automaton&oldid=343378592}", 70 | note = "[Online; accessed 17-March-2010]" 71 | } 72 | 73 | @book{ullman, 74 | title={{Introduction to automata theory, languages, and computation}}, 75 | author={Hopcroft, J.E. and Motwani, R. and Ullman, J.D.}, 76 | year={2006}, 77 | publisher={Addison-wesley} 78 | } 79 | 80 | @misc{linde, 81 | author ="Kai Linde", 82 | title = "Analyse des Einsatzes moderner Programmierparadigmen in der Roboterstuerung", 83 | year = "2007" 84 | } 85 | 86 | @misc{expertenhandbuch, 87 | author = "KUKA Roboter GmbH", 88 | title = "Programmierung Experte KUKA System Software (KSS) R5.4", 89 | year = "2005", 90 | note = "Stand: 23.02.2005 Version: 00" 91 | } 92 | 93 | @article{saraswat1997java, 94 | title={{Java is not type-safe}}, 95 | author={Saraswat, V.}, 96 | journal={manuscript, AT\&T Research, New York}, 97 | year={1997}, 98 | publisher={Citeseer} 99 | } 100 | 101 | @book{ANTLR, 102 | author = {Terence Parr}, 103 | edition = {First}, 104 | interhash = {d9ef4ed82183b86b6a3004161de5ea44}, 105 | intrahash = {1688029f4c14bd3b234933a48e902c03}, 106 | publisher = {Pragmatic Bookshelf}, 107 | series = {Pragmatic Programmers}, 108 | title = {The Definitive ANTLR Reference: Building Domain-Specific Languages}, 109 | url = {http://www.amazon.com/Definitive-ANTLR-Reference-Domain-Specific-Programmers/dp/0978739256%3FSubscriptionId%3D13CT5CVB80YFWJEPWS02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0978739256}, 110 | year = 2007, 111 | ean = {9780978739256}, 112 | keywords = {Me:MastersThesis antlr compilers languages lexers parsers programming}, 113 | asin = {0978739256}, 114 | description = {Amazon.com: The Definitive ANTLR Reference: Building Domain-Specific Languages (Pragmatic Programmers): Terence Parr: Books}, 115 | isbn = {0978739256}, 116 | biburl = {http://www.bibsonomy.org/bibtex/21688029f4c14bd3b234933a48e902c03/gron}, 117 | dewey = {005.45}, 118 | month = May 119 | } 120 | 121 | @article{parr1996ll, 122 | title={{LL and LR translators need k> 1 lookahead}}, 123 | author={Parr, T.J. and Quong, R.W.}, 124 | journal={ACM Sigplan Notices}, 125 | volume={31}, 126 | number={2}, 127 | pages={27--34}, 128 | year={1996}, 129 | publisher={ACM} 130 | } 131 | 132 | @book{dragoonBook, 133 | author = {Alfred V. Aho and Monica S. Lam and Ravi Sethi and Jeffrey D. Ullman}, 134 | howpublished = {Hardcover}, 135 | interhash = {6bc8d88ce1094de53ec7ec47b7ba4973}, 136 | intrahash = {c3bc558a481f3cf0445068988a80f1b2}, 137 | publisher = {{Addison Wesley}}, 138 | title = {Compilers: Principles, Techniques, and Tools (2nd Edition)}, 139 | url = {http://www.amazon.ca/exec/obidos/redirect?tag=citeulike09-20\&path=ASIN/0321486811}, 140 | year = 2006, 141 | keywords = {compilers}, 142 | posted-at = {2009-05-19 16:04:16}, 143 | description = {CiteULike: Everyone's library}, 144 | priority = {2}, 145 | isbn = {0321486811}, 146 | biburl = {http://www.bibsonomy.org/bibtex/2c3bc558a481f3cf0445068988a80f1b2/earthfare}, 147 | citeulike-article-id = {1033375}, 148 | month = {August} 149 | } 150 | 151 | 152 | @article{Knuth:1965:LR, 153 | author = {Knuth, Donald}, 154 | citeulike-article-id = {5914311}, 155 | journal = {Information and Control}, 156 | keywords = {parsing}, 157 | pages = {607--639}, 158 | posted-at = {2009-10-09 06:17:47}, 159 | priority = {2}, 160 | title = {On the Translation of Languages from Left to Right}, 161 | volume = {8}, 162 | year = {1965} 163 | } 164 | 165 | 166 | @MISC{antlr:targets, 167 | AUTHOR = "Terance Parr et al", 168 | TITLE = "ANTLR code generation targets", 169 | MONTH = "May", 170 | YEAR = {2010}, 171 | NOTE = "\url{http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets?focusedCommentId=23232603#comment-23232603}" 172 | } 173 | 174 | @MISC{antlr:works, 175 | AUTHOR = "Jean Bovet and Terance Parr", 176 | TITLE = "ANTLRWorks: An ANTLR Grammar Development Environment", 177 | MONTH = "July", 178 | YEAR = {2007}, 179 | NOTE = "\url{http://www.antlr.org/papers/antlrworks-draft.pdf}" 180 | } 181 | 182 | @MISC{antlr:keywords, 183 | AUTHOR = "Terance Parr", 184 | TITLE = "How can I allow keywords as identifiers?", 185 | MONTH = "June", 186 | YEAR = {2008}, 187 | NOTE = "\url{http://www.antlr.org/wiki/pages/viewpage.action?pageId=1741}" 188 | } 189 | 190 | @misc{ wiki:ast, 191 | author = "Wikipedia", 192 | title = "Abstract syntax tree --- Wikipedia{,} The Free Encyclopedia", 193 | year = "2010", 194 | url = "\url{http://en.wikipedia.org/w/index.php?title=Abstract_syntax_tree&oldid=351440895}", 195 | note = "[Online; accessed 30-March-2010]" 196 | } 197 | 198 | @misc{lrpdf, 199 | author = "Andreas Kunert", 200 | title = "LR Parser für Pragmatiker", 201 | year = "2008", 202 | url = "\url{http://www2.informatik.hu-berlin.de/~kunert/papers/lr-analyse/}" 203 | } 204 | 205 | @book{LangImplPatterns, 206 | abstract = {Learn to build configuration file readers, data readers, model-driven code generators, source-to-source translators, source analyzers, and interpreters. You don't need a background in computer science-ANTLR creator Terence Parr demystifies language implementation by breaking it down into the most common design patterns. Pattern by pattern, you'll learn the key skills you need to implement your own computer languages.}, 207 | author = {Parr, Terence}, 208 | keywords = {language\_implementation}, 209 | priority = {0}, 210 | publisher = {The Pragmatic Bookshelf}, 211 | title = {Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages}, 212 | year = {2009} 213 | } 214 | 215 | @article{lua, 216 | author = "R. Ierusalimschy and L.H. de Figueiredo and W. Celes", 217 | title = "The Implementation of Lua 5.0", 218 | abstract = "We discuss the main novelties of the implementation of Lua 5.0: its register-based virtual machine, the new algorithm for optimizing tables used as arrays, the implementation of closures, and the addition of coroutines.", 219 | journal = "Journal of Universal Computer Science", 220 | year = "2005", 221 | volume = "11", 222 | number = "7", 223 | pages = "1159--1176" 224 | } 225 | 226 | 227 | 228 | @misc{treebased-interpreter, 229 | AUTHOR = "Terance Parr", 230 | TITLE = "Tree based interpreters", 231 | MONTH = "May", 232 | YEAR = {2009}, 233 | NOTE = "\url{http://www.antlr.org/wiki/display/ANTLR3/The+difference+between+compilers+and+interpreters}" 234 | } 235 | 236 | @article{D'Souza2010, 237 | author = {D'Souza, Neil S and Lopes, Luiz A.C. and Liu, XueJun}, 238 | doi = {10.1016/j.epsr.2009.09.012}, 239 | file = {:C$\backslash$:/Users/z/Documents/Mendeley Desktop/D'Souza, Lopes, Liu - 2010 - Comparative study of variable size perturbation and observation maximum power point trackers for PV systems.pdf:pdf}, 240 | issn = {03787796}, 241 | journal = {Electric Power Systems Research}, 242 | keywords = {MPPT,Maximum Power Point Tracking,Photovoltaics}, 243 | mendeley-tags = {MPPT,Maximum Power Point Tracking,Photovoltaics}, 244 | month = mar, 245 | number = {3}, 246 | pages = {296--305}, 247 | title = {{Comparative study of variable size perturbation and observation maximum power point trackers for PV systems}}, 248 | url = {http://linkinghub.elsevier.com/retrieve/pii/S0378779609002235}, 249 | volume = {80}, 250 | year = {2010} 251 | } 252 | 253 | @misc{publisher_hrsc_????, 254 | title = {{HRSC} Data Browser}, 255 | author = {publisher} 256 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Running-tests-using-travis-ci", 3 | "version": "1.0.0", 4 | "description": "Using TestCafe tests in the cloud using Firefox and Chrome with Travis CI.", 5 | "scripts": { 6 | "test": "testcafe chrome,firefox test/test.js" 7 | }, 8 | "devDependencies": { 9 | "testcafe": "*" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /test/html/academicstyle.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 |
26 |
27 |
28 |

Refereed Articles

29 |
30 |
31 |
32 |
33 |
34 |

Books

35 |
36 |
37 |
38 |
39 |
40 |

Conference and Workshop Papers

41 |
42 |
43 |
44 |
45 |
46 |

Other Publications

47 |
48 |
49 |
50 |
51 |
52 |
53 | 54 |
55 |

Rendered Publications

56 | 57 |
58 |
59 | 60 |
61 |
62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /test/html/author_click_sort.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Test 9 | 10 | 11 | 12 | 23 | 24 | 25 | 26 | 27 |

Test for Sorting Authors by Clicking Their Name

28 | 29 |
30 |
31 | 32 |
33 |
34 | 35 | 43 | 44 | 45 |
46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /test/html/authorformat.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 | , , 31 |
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/html/authors.bib: -------------------------------------------------------------------------------- 1 | @book{1.1, 2 | author={First Last}, 3 | }, 4 | 5 | @book{1.2, 6 | author={First Name Last}, 7 | }, 8 | 9 | @book{1.3, 10 | author={First von Last}, 11 | }, 12 | 13 | @book{1.4, 14 | author={First {von} Last}, 15 | }, 16 | 17 | @book{1.5, 18 | author={First {\relax von} Last}, 19 | }, 20 | 21 | @book{1.5.2, 22 | author={First {\relax Von} Last}, 23 | }, 24 | 25 | @book{1.6, 26 | author={First Name de Last}, 27 | }, 28 | 29 | @book{1.7, 30 | author={{First Name de} Last}, 31 | }, 32 | 33 | @book{1.8, 34 | author={First de Middle de Last}, 35 | }, 36 | 37 | @book{1.9, 38 | author={First {Last Name}}, 39 | }, 40 | 41 | @book{1.10, 42 | author={von de middle de last}, 43 | }, 44 | 45 | @book{2.1, 46 | author={Last, First}, 47 | }, 48 | 49 | @book{2.2, 50 | author={von Last, First}, 51 | }, 52 | 53 | @book{2.3, 54 | author={Von de Name de Long Last, First}, 55 | }, 56 | 57 | @book{3.1, 58 | author={von Last, Jr., First}, 59 | }, 60 | 61 | @book{3.2, 62 | author={Last, Jr., {First von}}, 63 | }, 64 | 65 | @book{4.1, 66 | author={Last, First and First von Last}, 67 | }, 68 | 69 | @book{4.2, 70 | author={{Barnes and Noble, Inc.} and {Barnes and Noble, Inc.}}, 71 | }, 72 | 73 | -------------------------------------------------------------------------------- /test/html/autogenerateselects.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 43 | 44 | 50 | 51 | 55 | 56 | 57 | 58 | 60 | 61 |
62 |

Auto-Fill Selects Test File

63 | 64 | 67 | 68 | 71 | 72 | 75 | 76 | 79 | 80 | 83 | 84 | 88 | 89 |
90 |
91 | 92 |
93 |
94 | 95 | , 96 | 97 | 98 |
99 |
100 | 101 | 102 | 103 | 104 |
105 |
106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /test/html/autogenerateselects_lastfirstinitial.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 38 | 39 | 45 | 46 | 50 | 51 | 52 | 53 | 55 | 56 |
57 |

Auto-Fill Selects Test File

58 | 59 | 62 | 63 |
64 |
65 | 66 |
67 |
68 | 69 | , 70 | 71 | , 72 |
73 |
74 | 75 | 76 | 77 |
78 |
79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /test/html/autogenerateselects_sort.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 46 | 47 | 51 | 52 | 53 | 54 | 56 | 57 |
58 |

Auto-Fill Sort Selects Test File

59 | 60 | 64 | 65 | 69 | 70 | 74 | 75 |
76 |
77 | 78 |
79 |
80 | 81 | , 82 | 83 | 84 |
85 |
86 | 87 | 88 | 89 |
90 |
91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /test/html/bibtexVar.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 |

Testing bibtexVar so some values are in the attributes of the 26 | bibtex_template so they are not displayed

27 |
28 | 29 |
30 |
31 | 32 | 33 | 34 | 35 | (view online) 36 | 37 |
38 |
39 | 40 | 41 |
42 |
43 | 44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /test/html/bibtexkeys.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 |
26 |
27 |
28 |
29 |
30 | 31 |
32 | 33 | , 34 | 35 | 36 |
37 | 38 |
39 |

Rendered Publications

40 | 41 |

Two Displays

42 |
43 |
45 |
46 |

One Displays

47 |
48 |
49 |
50 |

Three Displays with same

51 |
52 |
54 |
55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /test/html/bibtexvar_css_escape.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 17 | 18 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |

Testing bibtexjs-css-escape with bibtexVar so some values are in the attributes of the 29 | bibtex_template so they are not displayed

30 | 31 | 35 | 36 |
37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /test/html/callback.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Callback Test 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Bibtex-js Callback Test

25 | 26 |
27 |
28 |
29 |
30 | 31 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /test/html/callback2.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Callback Test 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Bibtex-js Callback Test

25 | 26 |
27 |
28 |
29 |
30 |
31 | 32 | 33 |
34 |
35 | 36 |

First bibtex_display

37 |
38 |
39 |

Second bibtex_display

40 |
41 |
42 | 43 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /test/html/conjunction.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 | > 31 |
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/html/conjunction_custom_author_list.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 | , , 31 |
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/html/conjunction_empty.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/html/conjunction_missing.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/html/firstinitials.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 32 | 33 | 37 | 38 | 39 | 40 | 41 | 42 |
43 |

Rendered Publications

44 | 45 |
46 | 47 |
48 |
49 | 50 |
51 |
52 | 53 |
54 |
55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /test/html/group.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 |
31 |
32 |
33 |
34 | 35 |
36 |
37 | 38 | 39 | 40 | 41 | (view online) 42 | 43 |
44 |
45 | 46 | 47 |
48 |
49 | 50 |
51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /test/html/groupCustomHeader.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 |

31 |
32 |
33 |
34 |
35 | 36 |
37 |
38 | 39 | 40 | 41 | 42 | (view online) 43 | 44 |
45 |
46 | 47 | 48 |
49 |
50 | 51 |
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /test/html/ifequals.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 |
31 |
32 |
33 |
34 | 35 |
36 | 37 | Book 38 | 39 | No Space 40 | 41 | 42 | One Space 43 | 44 | 45 | 46 | Article 47 | 48 | 49 | Misc 50 | 51 |
52 | 53 |
54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /test/html/max1authors.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/html/max2authors.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/html/maxauthors.bib: -------------------------------------------------------------------------------- 1 | @book{1, 2 | author={Sammet, J.E.} 3 | }, 4 | @book{2, 5 | author={Sammet, J.E. and Hemmendinger, D.} 6 | }, 7 | @book{3, 8 | author={Sammet, J.E. and Hemmendinger, D. and Wikipedia } 9 | } 10 | -------------------------------------------------------------------------------- /test/html/selectingbyauthor.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Test 9 | 10 | 11 | 12 | 42 | 43 | 47 | 48 | 49 | 50 | 52 | 53 |
54 |

author="Tim Smith"

55 |
56 |

author="^(Tim Smith)"

57 |
58 |

author="Bob Last"

59 |
60 |

author="Tim Smith|Bob Last"

61 |
62 |

author="Tim Smith|Smith, T.|Smith, Tim"

63 |
64 | 65 | 66 | -------------------------------------------------------------------------------- /test/html/selectingentries.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 23 | 24 |
25 |

Rendered Publications

26 | 27 |
28 | 29 |
30 |
31 | 32 |
33 |
34 |
35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /test/html/simple.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /test/html/sort.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 |
31 |
32 |
33 |
34 | 35 |
36 |
37 | 38 | 39 | 40 | 41 | (view online) 42 | 43 |
44 |
45 | 46 | 47 |
48 |
49 | 50 |
51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /test/html/sort_missing_date.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 |
31 |
32 |
33 |
34 | 35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | (view online) 48 | 49 |
50 |
51 | 52 | 53 |
54 |
55 | 56 |
57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /test/html/sort_missing_year.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | Bibtex-js Demo 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |

Rendered Publications

25 | 26 |
27 | 28 |
29 |
30 |
31 |
32 |
33 |
34 | 35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | (view online) 48 | 49 |
50 |
51 | 52 | 53 |
54 |
55 | 56 |
57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /test/html/testing.bib: -------------------------------------------------------------------------------- 1 | @book{sammet2003programming, 2 | title={{Programming languages}}, 3 | author={Sammet, J.E. and Hemmendinger, D.}, 4 | year={2003}, 5 | date={2003-01-01}, 6 | publisher={John Wiley and Sons Ltd.} 7 | }, 8 | 9 | @book{bauer1998ubersetzung, 10 | title={Übersetzung objektorientierter Programmiersprachen: Konzepte, abstrakte Maschinen und Praktikum \glqq Java Compiler\grqq}, 11 | author={Bauer, B. and Höllerer, R.}, 12 | year={1998}, 13 | publisher={Springer} 14 | } 15 | 16 | @article{parr1995antlr, 17 | title={{ANTLR: A predicated-LL (k) parser generator}}, 18 | author={Parr, T.J. and Quong, R.W.}, 19 | journal={Software-Practice and Experience}, 20 | volume={25}, 21 | number={7}, 22 | pages={789--810}, 23 | year={1995}, 24 | publisher={Citeseer} 25 | } 26 | 27 | @misc{ wiki:chomskyh, 28 | author = "Wikipedia", 29 | title = "Chomsky-Hierarchie --- Wikipedia{,} Die freie Enzyklopädie", 30 | year = "2003", 31 | url = "\url{http://de.wikipedia.org/w/index.php?title=Chomsky-Hierarchie&oldid=71123007}", 32 | note = "[Online; Stand 11. März 2010]" 33 | } 34 | 35 | @book{ANTLR, 36 | author = {Terence Parr}, 37 | edition = {First}, 38 | interhash = {d9ef4ed82183b86b6a3004161de5ea44}, 39 | intrahash = {1688029f4c14bd3b234933a48e902c03}, 40 | publisher = {Pragmatic Bookshelf}, 41 | series = {Pragmatic Programmers}, 42 | title = {The Definitive ANTLR Reference: Building Domain-Specific Languages}, 43 | url = {http://www.amazon.com/Definitive-ANTLR-Reference-Domain-Specific-Programmers/dp/0978739256%3FSubscriptionId%3D13CT5CVB80YFWJEPWS02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0978739256}, 44 | year = 2007, 45 | ean = {9780978739256}, 46 | keywords = {Me:MastersThesis antlr compilers languages lexers parsers programming}, 47 | asin = {0978739256}, 48 | description = {Amazon.com: The Definitive ANTLR Reference: Building Domain-Specific Languages (Pragmatic Programmers): Terence Parr: Books}, 49 | isbn = {0978739256}, 50 | biburl = {http://www.bibsonomy.org/bibtex/21688029f4c14bd3b234933a48e902c03/gron}, 51 | dewey = {005.45}, 52 | month = May 53 | } -------------------------------------------------------------------------------- /test/html/testing_partial_date_year.bib: -------------------------------------------------------------------------------- 1 | @misc{a, 2 | author = "A", 3 | title = "AAA", 4 | year = "2003", 5 | month = "Jun", 6 | } 7 | 8 | @misc{b, 9 | author = "B", 10 | title = "BBB", 11 | date = "2003-08-01", 12 | } 13 | 14 | @misc{c, 15 | author = "C", 16 | title = "CCC", 17 | date = "2001-02-01", 18 | } 19 | 20 | @misc{d, 21 | author = "D", 22 | title = "DDD", 23 | year = "2005", 24 | } 25 | 26 | @misc{e, 27 | author = "E", 28 | title = "EEE", 29 | year = "2001", 30 | } 31 | 32 | -------------------------------------------------------------------------------- /test/test.js: -------------------------------------------------------------------------------- 1 | import { 2 | Selector 3 | } from 'testcafe'; 4 | 5 | fixture `Simple Tests` 6 | .page `http://localhost:8000/test/html/simple.html`; 7 | 8 | test('Check Entries', async t => { 9 | const entry0 = await Selector('.bibtexentry'); 10 | const entry1 = await Selector('.bibtexentry', { 11 | index: 1 12 | }); 13 | const entry2 = await Selector('.bibtexentry', { 14 | index: 2 15 | }); 16 | const entry3 = await Selector('.bibtexentry', { 17 | index: 3 18 | }); 19 | const entry4 = await Selector('.bibtexentry', { 20 | index: 4 21 | }); 22 | const entries = Selector('#bibtex_display').find('.bibtexentry').count; 23 | await t 24 | .expect(entry0).ok() 25 | .expect(entry2).ok() 26 | .expect(entries).ok() 27 | .expect(entries).eql(5) 28 | .expect(await entry0.find('.title', { 29 | index: 0 30 | }).innerText).eql('Programming languages') 31 | .expect(await entry0.find('.author', { 32 | index: 0 33 | }).innerText).eql('J.E. Sammet, and D. Hemmendinger') 34 | .expect(await entry0.find('.year', { 35 | index: 0 36 | }).innerText).eql('2003') 37 | .expect(await entry1.find('.title', { 38 | index: 1 39 | }).innerText).eql('Übersetzung objektorientierter Programmiersprachen: Konzepte, abstrakte Maschinen und Praktikum \\glqq Java Compiler\\grqq') 40 | .expect(await entry1.find('.author', { 41 | index: 1 42 | }).innerText).eql('B. Bauer, and R. Höllerer') 43 | .expect(await entry1.find('.year', { 44 | index: 1 45 | }).innerText).eql('1998') 46 | .expect(await entry2.find('.title', { 47 | index: 2 48 | }).innerText).eql('ANTLR: A predicated-LL (k) parser generator') 49 | .expect(await entry2.find('.author', { 50 | index: 2 51 | }).innerText).eql('T.J. Parr, and R.W. Quong') 52 | .expect(await entry2.find('.year', { 53 | index: 2 54 | }).innerText).eql('1995') 55 | .expect(await entry3.find('.title', { 56 | index: 3 57 | }).innerText).eql('Chomsky-Hierarchie --- Wikipedia, Die freie Enzyklopädie') 58 | .expect(await entry3.find('.author', { 59 | index: 3 60 | }).innerText).eql('Wikipedia') 61 | .expect(await entry3.find('.year', { 62 | index: 3 63 | }).innerText).eql('2003') 64 | .expect(await entry4.find('.title', { 65 | index: 4 66 | }).innerText).eql('The Definitive ANTLR Reference: Building Domain-Specific Languages') 67 | .expect(await entry4.find('.author', { 68 | index: 4 69 | }).innerText).eql('Terence Parr') 70 | .expect(await entry4.find('.year', { 71 | index: 4 72 | }).innerText).eql('2007'); 73 | }); 74 | 75 | test('Check URL links', async t => { 76 | const entry4 = await Selector('.bibtexentry', { 77 | index: 3 78 | }); 79 | const url4 = await entry4.find('.url', { 80 | index: 0 81 | }); 82 | const entry13 = await Selector('.bibtexentry', { 83 | index: 4 84 | }); 85 | const url13 = await entry13.find('.url', { 86 | index: 0 87 | }); 88 | 89 | await t 90 | .expect(url4.getAttribute('href')).eql('http://de.wikipedia.org/w/index.php?title=Chomsky-Hierarchie&oldid=71123007') 91 | .expect(url13.getAttribute('href')).eql('http://www.amazon.com/Definitive-ANTLR-Reference-Domain-Specific-Programmers/dp/0978739256%3FSubscriptionId%3D13CT5CVB80YFWJEPWS02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0978739256'); 92 | }) 93 | 94 | 95 | fixture `Sort Test` 96 | .page `http://localhost:8000/test/html/sort.html`; 97 | 98 | test('Check Sort ASC String', async t => { 99 | const entries = Selector('#bibtex_display').find('.bibtexentry'); 100 | const entriesCount = Selector('#bibtex_display').find('.bibtexentry').count; 101 | await t 102 | .expect(entries).ok() 103 | .expect(entriesCount).eql(5); 104 | 105 | for (var i = 1; i < 5; i++) { 106 | await t.expect(Number(await entries.nth(i).find('.year').innerText)) 107 | .gte(Number(await entries.nth(i - 1).find('.year').innerText)); 108 | } 109 | 110 | }) 111 | 112 | 113 | test 114 | .page `http://localhost:8000/test/html/sort_missing_date.html` 115 | ('Check Sort missing date', async t => { 116 | const entries = Selector('#bibtex_display').find('.bibtexentry'); 117 | const entriesCount = Selector('#bibtex_display').find('.bibtexentry').count; 118 | await t 119 | .expect(entries).ok() 120 | .expect(entriesCount).eql(5); 121 | 122 | var authors = ['E', 'C', 'A', 'B', 'D']; 123 | 124 | for (var i = 0; i < 5; i++) { 125 | await t.expect(await entries.nth(i).find('.author').textContent) 126 | .eql(authors[i]); 127 | } 128 | }) 129 | 130 | 131 | test 132 | .page `http://localhost:8000/test/html/sort_missing_year.html` 133 | ('Check Sort missing year', async t => { 134 | const entries = Selector('#bibtex_display').find('.bibtexentry'); 135 | const entriesCount = Selector('#bibtex_display').find('.bibtexentry').count; 136 | await t 137 | .expect(entries).ok() 138 | .expect(entriesCount).eql(5); 139 | 140 | var grp0 = ['C', 'E']; // 2001 141 | var grp1 = ['A', 'B']; // 2003 142 | var grp2 = ['D']; // 2005 143 | 144 | var grps = [grp0, grp0, grp1, grp1, grp2]; 145 | 146 | for (var i = 0; i < 5; i++) { 147 | await t.expect(grps[i]) 148 | .contains(await entries.nth(i).find('.author').textContent); 149 | } 150 | }) 151 | 152 | 153 | 154 | fixture `Group Test` 155 | .page `http://localhost:8000/test/html/group.html`; 156 | 157 | test('Check Group ASC String', async t => { 158 | const entries = Selector('#bibtex_display').find('.bibtexentry'); 159 | const entriesCount = Selector('#bibtex_display').find('.bibtexentry').count; 160 | const groups = Selector('.group'); 161 | await t 162 | .expect(entries).ok() 163 | .expect(entriesCount).eql(5) 164 | .expect(groups.count).eql(4); 165 | 166 | for (var i = 1; i < 5; i++) { 167 | await t.expect(Number(await entries.nth(i).find('.year').innerText)) 168 | .gte(Number(await entries.nth(i - 1).find('.year').innerText)); 169 | } 170 | 171 | }) 172 | 173 | fixture `Group Custom Header` 174 | .page `http://localhost:8000/test/html/groupCustomHeader.html`; 175 | 176 | test('Check custom titles', async t => { 177 | const titles = Selector('h2'); 178 | await t 179 | .expect(titles.count).eql(4); 180 | 181 | var years = [1995, 1998, 2003, 2007]; 182 | 183 | for (var i = 0; i < 4; i++) { 184 | await t 185 | .expect(Number(await titles.nth(i).innerText)).eql(Number(years[i])) 186 | .expect(Number(await titles.nth(i).getAttribute("id"))).eql(Number(years[i])); 187 | } 188 | 189 | }) 190 | 191 | fixture `Individual bibtex keys` 192 | .page `http://localhost:8000/test/html/bibtexkeys.html` 193 | 194 | test('Check Individual BibTeX Keys Test', async t => { 195 | const bibtexdisplay = Selector('.bibtex_display'); 196 | const bibtexentries = Selector('.bibtexentry'); 197 | 198 | // Check the total count of display and entries 199 | await t 200 | .expect(bibtexdisplay).ok() 201 | .expect(bibtexentries).ok() 202 | .expect(bibtexdisplay.count).eql(3) 203 | .expect(bibtexentries.count).eql(6); 204 | 205 | var counter = 0; 206 | var keys = ["sammet2003programming", "bauer1998ubersetzung", "parr1995antlr", "sammet2003programming", "wiki:chomskyh", "parr1995antlr"]; 207 | 208 | // Check the number in each bibtex display 209 | var array = [2, 1, 3]; 210 | for (var i = 0; i < 3; ++i) { 211 | var display = bibtexdisplay.nth(i).find('.bibtexentry') 212 | await t.expect(display.count).eql(array[i]); 213 | 214 | // Check if they are sorted 215 | for (var j = 1; j < array[i]; ++j) { 216 | const first = display.nth(j).find('.year'); 217 | const second = display.nth(j - 1).find('.year'); 218 | await t.expect(Number(await first.innerText)).lte(Number(await second.innerText)); 219 | } 220 | 221 | // Check that each entry has the corrent bibtexkey 222 | for (var j = 0; j < array[i]; ++j) { 223 | const key = display.nth(j).find('.bibtexkey'); 224 | await t.expect(await key.innerText).eql(keys[counter]); 225 | counter++; 226 | } 227 | } 228 | 229 | }) 230 | 231 | fixture `Academic Style Test` 232 | .page `http://localhost:8000/test/html/academicstyle.html` 233 | 234 | test('Check academic style', async t => { 235 | const divs = Selector('#bibtex_display').child('div'); 236 | const bibtexentries = Selector('.bibtexentry'); 237 | const sections = Selector('.sections').child('div'); 238 | 239 | //console.log(await divs); 240 | // Check the total count of display and entries 241 | await t 242 | .expect(divs).ok() 243 | .expect(bibtexentries).ok() 244 | .expect(sections.count).eql(3) 245 | .expect(bibtexentries.count).eql(5); 246 | 247 | var titles = ['refereed articles', 'books', 'other publications']; 248 | var count = [1, 3, 1]; 249 | var bibtextypekey = ["ARTICLE", "BOOK", "MISC"]; 250 | 251 | // Check if the title is correct and it has the correct number of entries 252 | for (var i = 0; i < 3; ++i) { 253 | const subbibtexentries = sections.nth(i).find('.bibtexentry'); 254 | await t 255 | .expect(subbibtexentries.count).eql(count[i]); 256 | 257 | // Test that the entries are of the correct type 258 | const stringNode = subbibtexentries.withExactText(bibtextypekey[i]); 259 | await t.expect(stringNode.count).eql(count[i]); 260 | } 261 | }) 262 | 263 | fixture `BibTexVar replacement test` 264 | .page `http://localhost:8000/test/html/bibtexVar.html` 265 | 266 | test('Check class=bibtexVar', async t => { 267 | const entries = Selector('#bibtex_display').find('.bibtexentry'); 268 | const entriesCount = Selector('#bibtex_display').find('.bibtexentry').count; 269 | await t 270 | .expect(entries).ok() 271 | .expect(entriesCount).eql(5); 272 | 273 | var years = ["2003", "1998", "1995", "2003", "2007"]; 274 | var authors = ["Sammet, J.E. and Hemmendinger, D.", 275 | "Bauer, B. and Höllerer, R.", 276 | "Parr, T.J. and Quong, R.W.", 277 | "Wikipedia", 278 | "Terence Parr" 279 | ]; 280 | 281 | for (var i = 1; i < 5; i++) { 282 | const entry = entries.nth(i); 283 | await t 284 | .expect(await entry.find('.bibtexVar').withAttribute('year', years[i]).count).eql(1) 285 | .expect(await entry.find('.bibtexVar').withAttribute('author', authors[i]).count).eql(1); 286 | } 287 | 288 | }) 289 | 290 | fixture `BibTexVar bibtexjs-css-escape test` 291 | .page `http://localhost:8000/test/html/bibtexvar_css_escape.html` 292 | 293 | test('Check bibtexjs-css-escape', async t => { 294 | const entries = Selector('#bibtex_display').find('.bibtexentry'); 295 | await t 296 | .expect(entries).ok(); 297 | 298 | const entry = entries.nth(0); 299 | await t 300 | .expect(await entry.find('.bibtexVar').withAttribute('bibtexkey').getAttribute('bibtexkey')).eql("a1\\:2\\:3_4\\.\\+-\\*\\/\\'\\?") 301 | .expect(await entry.find('.bibtexVar').withAttribute('test').getAttribute('test')).eql("\\!\\ \\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\`\\{\\|\\}\\~"); 302 | 303 | }) 304 | 305 | fixture `BibTexAuthors test` 306 | .page `http://localhost:8000/test/html/authorformat.html` 307 | 308 | test('Check printing authors names', async t => { 309 | const entries = Selector('#bibtex_display').find('.bibtexentry'); 310 | const entriesCount = Selector('#bibtex_display').find('.bibtexentry').count; 311 | await t 312 | .expect(entries).ok() 313 | .expect(entriesCount).eql(18); 314 | 315 | var authors = [" Last, First", 316 | " Last, First Name", 317 | "von Last, First", 318 | " Last, First von", 319 | "von Last, First", 320 | " Last, First Von", 321 | "de Last, First Name", 322 | " Last, First Name de", 323 | "de Middle de Last, First", 324 | " Last Name, First", 325 | "von de middle de last", 326 | " Last, First", 327 | "von Last, First", 328 | "Von de Name de Long Last, First", 329 | "von Last, Jr., First", 330 | " Last, Jr., First von", 331 | " Last, First, and von Last, First", 332 | " Barnes and Noble, Inc., and Barnes and Noble, Inc." 333 | 334 | ]; 335 | 336 | for (var i = 1; i < authors.length; i++) { 337 | const entry = entries.nth(i); 338 | await t 339 | .expect(await entry.find('.author').textContent).eql(authors[i]); 340 | } 341 | 342 | }) 343 | 344 | fixture `Search Entries Test (no bibtex_structure)` 345 | .page `http://localhost:8000/test/html/selectingentries.html` 346 | 347 | test('Selecting bibtex entries check', async t => { 348 | const entries = Selector('.bibtex_display').find('.bibtexentry'); 349 | const entriesCount = Selector('.bibtex_display').find('.bibtexentry').count; 350 | const bibtex_display = Selector(".bibtex_display"); 351 | const bibtex_display_count = Selector(".bibtex_display").count; 352 | await t 353 | .expect(entries).ok() 354 | .expect(entriesCount).eql(6) 355 | .expect(bibtex_display_count).eql(3); 356 | 357 | var counts = [2, 1, 3]; 358 | 359 | for (var i = 0; i < counts.length; i++) { 360 | const entry = bibtex_display.nth(i); 361 | await t 362 | .expect(await entry.find(".bibtexentry").count).eql(counts[i]); 363 | } 364 | 365 | }) 366 | 367 | test('Search entries check', async t => { 368 | const searchbar = Selector('#searchbar'); 369 | await t 370 | .expect(searchbar).ok(); 371 | 372 | var searchTerms = ["Sammet", "1", "1998"]; 373 | var counts = [2, 3, 1]; 374 | 375 | for (var i = 0; i < searchTerms.length; i++) { 376 | await t.typeText(searchbar, searchTerms[i], { 377 | replace: true 378 | }); 379 | 380 | // Get visible entries 381 | const entries = Selector('.bibtex_display').find('.bibtexentry').filter(el => el.style.display !== 'none');; 382 | const entriesCount = entries.count; 383 | 384 | await t 385 | .expect(entries).ok() 386 | .expect(entriesCount).eql(counts[i]); 387 | } 388 | 389 | }) 390 | 391 | test 392 | .page `http://localhost:8000/test/html/author_click_sort.html` 393 | ('Select by clicking author', async t => { 394 | const authors = Selector('.clickauthors'); 395 | await t 396 | .expect(authors).ok() 397 | .expect(authors.count).eql(5); 398 | 399 | var authorNames = ["Name Last", "John Smith", "Bob Newman", "Name Last"]; 400 | var counts = [2, 1, 1, 2]; 401 | 402 | for (var i = 0; i < 4; i++) { 403 | // Skip the first one because its just the template that remains 404 | await t.click(authors.nth(i + 1)); 405 | 406 | // Get visible entries 407 | const entries = Selector('#bibtex_display').find('.bibtexentry').filter(el => el.style.display !== 'none'); 408 | const entriesCount = entries.count; 409 | 410 | await t 411 | .expect(entries).ok() 412 | .expect(entriesCount).eql(counts[i]); 413 | 414 | for (var j = 0; j < counts[i]; ++j) { 415 | await t.expect(entries.nth(j).textContent).contains(authorNames[i]); 416 | } 417 | 418 | await t.click('#showAll'); 419 | } 420 | }) 421 | 422 | fixture `Check Print One Author Test` 423 | .page `http://localhost:8000/test/html/max1authors.html` 424 | 425 | test('Print 1 author', async t => { 426 | const entries = Selector('#bibtex_display').find('.bibtexentry'); 427 | await t 428 | .expect(entries).ok() 429 | 430 | var authors = ["J.E. Sammet", 431 | "J.E. Sammet et al.", 432 | "J.E. Sammet et al." 433 | ]; 434 | 435 | for (var i = 0; i < authors.length; i++) { 436 | const entry = entries.nth(i); 437 | await t 438 | .expect(await entry.find('.author').textContent).eql(authors[i]); 439 | } 440 | }) 441 | 442 | fixture `Check Print Two Authors Test` 443 | .page `http://localhost:8000/test/html/max2authors.html` 444 | 445 | test('Print 2 authors', async t => { 446 | const entries = Selector('#bibtex_display').find('.bibtexentry'); 447 | await t 448 | .expect(entries).ok() 449 | 450 | var authors = ["J.E. Sammet", 451 | "J.E. Sammet, and D. Hemmendinger", 452 | "J.E. Sammet, D. Hemmendinger, et al." 453 | ]; 454 | 455 | for (var i = 0; i < authors.length; i++) { 456 | const entry = entries.nth(i); 457 | await t 458 | .expect(await entry.find('.author').textContent).eql(authors[i]); 459 | } 460 | }) 461 | 462 | fixture `Check Author Initials` 463 | .page `http://localhost:8000/test/html/firstinitials.html` 464 | 465 | test('first_initial', async t => { 466 | const entries = Selector('#bibtex_display').find('.first_initial'); 467 | const entriesCount = Selector('#bibtex_display').find('.first_initial').count; 468 | await t 469 | .expect(entries).ok() 470 | .expect(entriesCount).eql(4); // There are two missing because they don't have first names 471 | 472 | var initials = ["F.", 473 | "F. M.", 474 | "F. M. S.", 475 | "F.", 476 | ]; 477 | 478 | for (var i = 0; i < initials.length; i++) { 479 | const entry = entries.nth(i); 480 | await t 481 | .expect(await entry.textContent).eql(initials[i]); 482 | } 483 | }) 484 | 485 | fixture `Check if entrykey==value` 486 | .page `http://localhost:8000/test/html/ifequals.html` 487 | 488 | test('ifequals', async t => { 489 | const entries = Selector('#bibtex_display').find('.bibtexentry'); 490 | const entriesCount = Selector('#bibtex_display').find('.bibtexentry').count; 491 | await t 492 | .expect(entries).ok() 493 | .expect(entriesCount).eql(5); 494 | 495 | var values = ["Article", 496 | "Book", 497 | "Book No Space One Space", 498 | "Misc", 499 | "Book No Space One Space", 500 | ]; 501 | 502 | for (var i = 0; i < values.length; i++) { 503 | const entry = entries.nth(i); 504 | await t 505 | .expect(await entry.innerText).eql(values[i]); 506 | } 507 | }) 508 | 509 | fixture `Check conjunction in author list` 510 | .page `http://localhost:8000/test/html/conjunction.html` 511 | 512 | test('Conjunction', async t => { 513 | const entries = Selector('#bibtex_display').find('.bibtex_js_conjunction'); 514 | const entriesCount = entries.count; 515 | await t 516 | .expect(entries).ok() 517 | .expect(entriesCount).eql(3); 518 | 519 | for (var i = 0; i < 3; i++) { 520 | const entry = entries.nth(i); 521 | await t 522 | .expect(await entry.innerText).eql(' e'); 523 | } 524 | 525 | }) 526 | 527 | test('Custom Author Conjunction', async t => { 528 | await t 529 | .navigateTo('http://localhost:8000/test/html/conjunction_custom_author_list.html'); 530 | const entries = Selector('#bibtex_display').find('.bibtex_js_conjunction'); 531 | const entriesCount = entries.count; 532 | await t 533 | .expect(entries).ok() 534 | .expect(entriesCount).eql(3); 535 | 536 | for (var i = 0; i < 3; i++) { 537 | const entry = entries.nth(i); 538 | await t 539 | .expect(await entry.innerText).eql(' e'); 540 | } 541 | 542 | }) 543 | 544 | test('Conjunction Empty', async t => { 545 | await t 546 | .navigateTo('http://localhost:8000/test/html/conjunction_empty.html'); 547 | const entries = Selector('#bibtex_display').find('.bibtex_js_conjunction'); 548 | const entriesCount = entries.count; 549 | await t 550 | .expect(entries).ok() 551 | .expect(entriesCount).eql(3); 552 | 553 | for (var i = 0; i < 3; i++) { 554 | const entry = entries.nth(i); 555 | await t 556 | .expect(await entry.innerText).eql(', and'); 557 | } 558 | 559 | }) 560 | 561 | test('Conjunction Missing', async t => { 562 | await t 563 | .navigateTo('http://localhost:8000/test/html/conjunction_missing.html'); 564 | const entries = Selector('#bibtex_display').find('.bibtex_js_conjunction'); 565 | const entriesCount = entries.count; 566 | await t 567 | .expect(entries).ok() 568 | .expect(entriesCount).eql(3); 569 | 570 | for (var i = 0; i < 3; i++) { 571 | const entry = entries.nth(i); 572 | await t 573 | .expect(await entry.innerText).eql(', and'); 574 | } 575 | 576 | }) 577 | 578 | fixture `Selecting Bibtex Entries By Author` 579 | .page `http://localhost:8000/test/html/selectingbyauthor.html` 580 | 581 | test('Select By Author Test', async t => { 582 | const bibtexdisplay = Selector('.bibtex_display'); 583 | const bibtexentries = Selector('.bibtexentry'); 584 | 585 | // Check the total count of display and entries 586 | await t 587 | .expect(bibtexdisplay).ok() 588 | .expect(bibtexentries).ok() 589 | .expect(bibtexdisplay.count).eql(5); 590 | 591 | var counter = 0; 592 | var test = [ 593 | [1, 2, 3], 594 | [1, 3], 595 | [1, 4, 5], 596 | [1, 2, 3, 4, 5], 597 | [1, 2, 3, 5, 6] 598 | ]; 599 | 600 | // Check the number in each bibtex display 601 | for (var i = 0; i < 5; ++i) { 602 | var display = bibtexdisplay.nth(i).find('.bibtexentry') 603 | 604 | // Check that each entry has the correct number 605 | for (var j = 0; j < test[i].length; ++j) { 606 | const key = display.nth(j).find('.title'); 607 | await t.expect(Number(await key.innerText)).eql(test[i][j]); 608 | } 609 | } 610 | 611 | }) 612 | 613 | fixture `Callback functions simple case` 614 | .page `http://localhost:8000/test/html/callback.html` 615 | 616 | test('Test callbacks', async t => { 617 | const bibtexentries = Selector('.bibtexentry'); 618 | 619 | // Check the total count of display and entries 620 | await t 621 | .expect(bibtexentries).ok() 622 | .expect(bibtexentries.count).eql(5); 623 | 624 | // Check the number in each bibtex display 625 | for (var i = 0; i < 5; ++i) { 626 | var entry = bibtexentries.nth(i); 627 | await t.expect(await entry.innerText).eql(i + "bibtex_display"); 628 | } 629 | 630 | }) 631 | 632 | fixture `Callback functions with multiple bibtex_display and structure` 633 | .page `http://localhost:8000/test/html/callback2.html` 634 | 635 | test('Test multiple bibtex_display callbacks', async t => { 636 | const bibtexentries = Selector('.bibtexentry'); 637 | 638 | // Check the total count of display and entries 639 | await t 640 | .expect(bibtexentries).ok() 641 | .expect(bibtexentries.count).eql(10); 642 | 643 | // Check the number in each bibtex display 644 | var i = 0; 645 | for (; i < 5; ++i) { 646 | var entry = bibtexentries.nth(i); 647 | await t.expect(await entry.innerText).eql(i + "bibtex_display1"); 648 | } 649 | for (; i < 10; ++i) { 650 | var entry = bibtexentries.nth(i); 651 | await t.expect(await entry.innerText).eql(i + "bibtex_display2"); 652 | } 653 | 654 | }) 655 | 656 | fixture `Auto-Generate Selects` 657 | 658 | test 659 | .page `http://localhost:8000/test/html/autogenerateselects.html` 660 | ('Auto-Generated Select Contain Correct Information', async t => { 661 | const bibtexsearch = Selector('.bibtex_search'); 662 | 663 | // Authors, first authors, year, bibtexkey, bibtextypekey 664 | var lengths = [6, 5, 5, 6, 4, 9]; 665 | var values = [ 666 | ["", "Tim Bloke", "Bob Last, Jr.", "Steven Man", "M. Night", "John Smith"], 667 | ["", "Bob Last, Jr.", "Steven Man", "M. Night", "John Smith"], 668 | ["", "1990", "2000", "2001", "2011"], 669 | ["", "article1", "article2", "book1", "book2", "proceedings1"], 670 | ["", "ARTICLE", "BOOK", "INPROCEEDINGS"], 671 | ["", "Algorithm", "Chess", "Computer", "Democracy", "Politics", "Religion", "Society", "Supercomputer"], 672 | ]; 673 | 674 | // Check the total count of display and entries 675 | await t 676 | .expect(bibtexsearch).ok() 677 | .expect(bibtexsearch.count).eql(lengths.length); 678 | 679 | // Loop over each select that was auto generated 680 | for (var i = 0; i < lengths.length; ++i) { 681 | var options = bibtexsearch.nth(i).find('option'); 682 | await t.expect(options.count).eql(lengths[i]); 683 | for (var j = 0; j < lengths[i]; ++j) { 684 | var value = options.nth(j).value; 685 | await t.expect(value).eql(values[i][j]); 686 | } 687 | } 688 | }) 689 | 690 | test 691 | .page `http://localhost:8000/test/html/autogenerateselects_lastfirstinitial.html` 692 | ('Auto-Generated Author Select Last, First Initial', async t => { 693 | const bibtexsearch = Selector('.bibtex_search'); 694 | 695 | // Check the total count of display and entries 696 | await t 697 | .expect(bibtexsearch).ok() 698 | .expect(bibtexsearch.count).eql(1); 699 | 700 | // Authors shown, author value 701 | var values = [ 702 | ["Search Author", "Bloke, Tim", "Last, Bob Jr.", "Man, Steven", "Night, M.", "Smith, John"], 703 | ["", "Bloke, T.", "Last, B.", "Man, S.", "Night, M.", "Smith, J."], 704 | ]; 705 | 706 | var options = bibtexsearch.nth(0).find('option'); 707 | await t.expect(options.count).eql(6); 708 | for (var j = 0; j < 6; ++j) { 709 | var option = options.nth(j); 710 | await t 711 | .expect(option.innerText).eql(values[0][j]) 712 | .expect(option.value).eql(values[1][j]); 713 | } 714 | }) 715 | 716 | test 717 | .page `http://localhost:8000/test/html/autogenerateselects_sort.html` 718 | ('Auto-Generated Sort', async t => { 719 | const bibtexsearch = Selector('.bibtex_search'); 720 | 721 | // Check the total count of display and entries 722 | await t 723 | .expect(bibtexsearch).ok() 724 | .expect(bibtexsearch.count).eql(3); 725 | 726 | // Authors (default), authors (sv), titles 727 | var lengths = [10, 10, 8]; 728 | var values = [ 729 | ["", "Tim Bloke", "Name Čat", "Bob Last, Jr.", "Steven Man", "M. Night", "Name Öula", "Name Šat", "John Smith", "Name Zack"], 730 | ["", "Tim Bloke", "Name Čat", "Bob Last, Jr.", "Steven Man", "M. Night", "Name Šat", "John Smith", "Name Zack", "Name Öula"], 731 | ["", "0", "1", "2", "5", "6", "10", "12"], 732 | ]; 733 | 734 | // Loop over each select that was auto generated 735 | for (var i = 0; i < lengths.length; ++i) { 736 | var options = bibtexsearch.nth(i).find('option'); 737 | await t.expect(options.count).eql(lengths[i]); 738 | for (var j = 0; j < lengths[i]; ++j) { 739 | var value = options.nth(j).value; 740 | await t.expect(value).eql(values[i][j]); 741 | } 742 | } 743 | }) -------------------------------------------------------------------------------- /wiki/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pcooksey/bibtex-js/46dd3ce83cb793634b80882cb803b02a9974f106/wiki/logo.png --------------------------------------------------------------------------------