Closed rmzelle closed 6 years ago
I'm not entirely sure what the problem is, but it seems to be fixed in the v0.4.0-1
beta (which I see doesn't have a bundle yet). If you're okay with using this version (it has some new APIs, but should be backwards compatible), I can add the bundles to the archive branch. Alternatively, they are also available on the site:
Okay, it seems to be caused by the ID being a number, while citeproc-js casts it to a string. Because of that, the citeproc-js engine gets undefined
, which it doesn't handle particularly graceful. In the new versions of citation-js, strings and other types of IDs are always cast to a string.
I could backport a fix if needed.
Thanks for sorting this out!
No need to backport this for me. I probably want to be on 0.4.x anyway for the (experimental) RIS support.
I prefer to use a tagged release URL (to the minimized library), so it would be handy to have a 0.4.x release.
On Fri, May 11, 2018 at 07:20 Lars Willighagen notifications@github.com wrote:
Okay, it seems to be caused by the ID being a number, while citeproc-js casts it to a string, and then gets undefined, which it doesn't handle particularly graceful. In the new versions of citation-js, strings and other types of IDs are always cast to a string (which wasn't really my intention, as far as I can recall).
I could backport a fix if needed.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/larsgw/citation.js/issues/142#issuecomment-388377963, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEwf8cCVcA39eX3ZboNfwAn_j3muYzSks5txZ4wgaJpZM4T6fPS .
I released the v0.4.0-3
beta with RIS support, the CDN should load up soon:
Here's a demo on how to use the RIS output BTW: https://runkit.com/larsgw/citation.js-ris-output-demo
Basically this:
Cite(...).get({
format: 'string',
type: 'string',
style: 'ris'
})
Or, with the new API:
Cite(...).format('ris')
Additionally, you can pass parameters:
Cite(...).format('ris', {
type: 'text' // alternative: 'object' gives you an object representation
})
I'm having trouble using citation.js to convert CSL JSON to rendered citations. Converting to bibtex works as expected.
Based on https://runkit.com/larsgw/591b5651bd9b40001113931c, I get the following results:
gives
In contrast,
gives the error
(see https://runkit.com/5af4a2c58a83410012ddbf47/5af4a2d65bba2900126994f2#)
If I use
new Cite('Q21972834')
instead of using raw CSL-JSON as input both work. Any idea what's going on here?