Skip to content
Philip Cooksey edited this page Aug 3, 2019 · 7 revisions

Additional functionality

Search methods:

Multiple search fields are combined to find the intersection of the bibtex entries. If the value(s) being searched are not in a bibtex entry then it is hidden.

If there is a bibtex entry value that should not be searched then add the class noread.

<span class="bibtexraw noread"></span>

We define a search field with the class bibtex_search. Add options with values to be searched. The values are interpreted using regular expressions i.e., Multi-robot|multirobot|soccer finds the OR of the three strings. Regular expresssions is the only way to find the combination of bibtex entries rather than their intersection.

<select class="bibtex_search">
  <option value="">Search Topic</option>
  <!-- Add topic values here -->
  <option value="Robot Soccer">Robot Soccer</option>
  <option value="Multi-robot|multirobot|soccer">Multirobot Systems</option>
  <option value="Best Paper Award">Best Paper Award</option>
</select>

Adding the class bibtex_author will generate the author list within the select tags. The extra attribute defines that it will only be the first authors (can be removed for all authors). The search attribute defines that this value will only check the bibtex field author (results in a quicker search). The search can be changed to any field in the bibtex entries.

<select class="bibtex_search bibtex_author" extra="first" search="author">
  <option value="">Search First Author</option>
</select>

Adding the bibtex_search class to an input tag allows the user to search anything. The values are split up by spaces and then each is interpreted as a regular expressions.

<input type="text" class="bibtex_search" id="searchbar" placeholder="Search publications">

Variable access:

The class bibtexVar prints any bibtex entry value within the HTML elements attributes. The extra field defines what value to use e.g., the key associate with bibtex entry BIBTEXKEY. In any of the attributes use +BIBTEXKEY+ and the value will be printed there. In our example, the papers are stored with the bibtex key as the file name so the template system will generate the link to the page for each bibtex entry.

<a class="bibtexVar" href="http://www.website.edu/person/papers/+BIBTEXKEY+.pdf" extra="BIBTEXKEY">

The cases for needing a variable are rare but the bibtexkey provides a unique identifier for each bibtex entry. Another example uses the bibtexkey is in the html reference so that bootstrap can collapse each bibtex's raw format. There is a noread in the bibtexraw so that search doesn't look at it.

<div>
<a class="bibtexVar" role="button" data-toggle="collapse" href="#bib+BIBTEXKEY+" 
            aria-expanded="false" aria-controls="bib+BIBTEXKEY+" extra="BIBTEXKEY" bibtexjs-css-escape>
	[bib]
</a>
</div>
<div class="bibtexVar collapse" id="bib+BIBTEXKEY+" extra="BIBTEXKEY">
  <div class="well">
	<pre><span class="bibtexraw noread"></span></pre>
  </div>
</div>

The optional bibtexjs-css-escape attribute for bibtexVar is used to escape the characters that are not valid for javascript or other use cases. Example:

<div class="bibtexVar" test="+BIBTEXKEY+" extra="BIBTEXKEY"></div>
<!-- Becomes: <div class="bibtexVar" test="2017:book:author" extra="BIBTEXKEY"></div> -->
<div class="bibtexVar" test="+BIBTEXKEY+" extra="BIBTEXKEY" bibtexjs-css-escape></div>
<!-- Becomes: <div class="bibtexVar" test="2017\:book\:author" extra="BIBTEXKEY"></div> -->

Additional bibtex fields

BIBTEXKEY The bibtex entry key.

BIBTEXRAW The bibtex raw format.

BIBTEXTYPEKEY The bibtex entry type (@NAME capitalized by bibtex_js). Examples: @BOOK or @ARTICLE

BIBTEXTYPE

if (@INCOLLECTION") {
  ["BIBTEXTYPE"] = "book chapter";
} else if ("@INPROCEEDINGS") {
  ["BIBTEXTYPE"] = "conference, workshop";
} else if ("@ARTICLE") {
  ["BIBTEXTYPE"] = "journal";
} else if ("@TECHREPORT") {
  ["BIBTEXTYPE"] = "technical report";
}   

WEB Set to no then it will not be displayed (if it doesn't exist or yes then it will be displayed).

Clone this wiki locally