Why is the year missing from bibtex rendered via citation.js?

308 Views Asked by At

I'm using node to run citation.js to turn bibtex into HTML. Unfortunately the year is missing in the rendered HTML and I cannot see why.

test.js:

var Cite = require("citation-js");

var bibtex =
'@article{id, ' +
'  author={Happy Larry},' +
'  date={2017-01-01},' +
'  title="A Lovely Title"' +
'}';

var opts = {
    type: 'html',
    style: 'citation-vancouver',
}

var data = new Cite(bibtex, opts);

var g = data.get();

console.log(g);

Output:

$ node ./test.js
<div class="csl-bib-body">
  <div data-csl-entry-id="id" class="csl-entry">
    <div class="csl-left-margin">1. </div><div class="csl-right-inline">Larry H. A Lovely Title.</div>
  </div>
</div>

I would expect the year to be in there somewhere. Yet it fails to materialise no matter which CSL style I use. I've tried several chunks of bibtex, and I've downloaded several CSL styles from citationstyles.org. Everything else works as expected apart from the year, which is always missing.

Is this a bug in citation.js?

I notice that the year is missing in the output on the demo page.

1

There are 1 best solutions below

0
On BEST ANSWER

This post is made in accordance with this meta post.


As @Rintze Zelle also said in the comments, this is (was) indeed a bug in Citation.js. It's fixed in v0.3.0-12. This more general bug report in Citation.js has more info on the problem.