larsgw / citation.js

Citation.js converts formats like BibTeX, Wikidata JSON and ContentMine JSON to CSL-JSON to convert to other formats like APA, Vancouver and back to BibTeX.
https://citation.js.org/
MIT License
222 stars 30 forks source link

Time span #177

Closed JohannaDangel closed 5 years ago

JohannaDangel commented 5 years ago

Hello,

when using a time span (e.g. 2018-2019) instead of a precise year for publication there is no error but only the first four digits will appear in the citation afterwards. Using curly brackets and hyphens does not work either.

Is there a possibility to show more than four digits and if not could you please fix this?

larsgw commented 5 years ago

Which input format are you using? It's possible to denote a date range in CSL-JSON, but I don't know about e.g. BibTeX.

JohannaDangel commented 5 years ago

Hello, we use BibTeX as input format. The paragraph elements, who should contains the Cite, have the class “appendCite“.

const Cite = require('citation-js')

var params={
format: 'string/bibtex',
type: 'html',
style: 'citation-havard1',
lang: "de"
};

append the Cite to the paragraph:

$(document).find('.appendCite').each(function() {
var myData = $(this).data('bibtex');
$(this).append(new Cite(myData).get(params));
});

Example: BibTeX input: @BOOK{Schuster1989-94, address={Wien}, volume={I--III}, series={Historisches Ortsnamenbuch von Niederösterreich. Reihe B}, year={1989--1994}, author={Schuster, Elisabeth}, title={Die Etymologie der niederösterreichischen Ortsnamen} }

Result: Schuster, E. (1989). Die Etymologie der niederösterreichischen Ortsnamen (Bd. I–III). Wien.

Expected: Schuster, E. (1989-1994). Die Etymologie der niederösterreichischen Ortsnamen (Bd. I–III). Wien.