Skip to content

Variable Access

Philip Cooksey edited this page Feb 1, 2020 · 2 revisions

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> -->
Clone this wiki locally