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
219 stars 30 forks source link

Error processing doi #206

Closed jolyonralph closed 2 years ago

jolyonralph commented 3 years ago

When trying to process this doi:

10.1130/0091-7613(1995)023<0292:FOITVS>2.3.CO;2

I'm getting: Uncaught Error: This format is not supported or recognised.

From : https://pubs.geoscienceworld.org/gsa/geology/article-abstract/23/4/292/206248/Formation-of-Ishtar-Terra-Venus-Surface-and?redirectedFrom=fulltext

I am calling it with this code, which is set to auto-detect input type.

I haven't yet tried it specifying the input type manually. (Also, on this subject, there's an error in the documentation, the link for 'Options' throughout is a dead link.)

// test code let data = "10.1130/0091-7613(1995)023<0292:FOITVS>2.3.CO;2";

let opt={ format: 'string', type: 'json', lang: 'English', style: 'csl' }

let result = cite.set(data).get(opt);

I assume there's some pattern matching issue with the < or > ?

larsgw commented 3 years ago

I assume there's some pattern matching issue with the < or > ?

Correct, Citation.js uses the first pattern from https://www.crossref.org/blog/dois-and-matching-regular-expressions/ which does not catch this one. At some point I might as well add the other ones, it does not look like it would produce much by-catch.

I haven't yet tried it specifying the input type manually.

You can specify it manually like this:

let result = cite.set(data, { forceType: '@doi/id' }).get(opt);

You could also add the other patterns but that might be a bit more complicated.

Also, on this subject, there's an error in the documentation, the link for 'Options' throughout is a dead link.

What page has the broken link? Maybe it works in https://citation.js.org/api/0.5/

jolyonralph commented 3 years ago

The broken links are on, for example, https://citation.js.org/api/Cite.html

Links are to https://citation.js.org/#cite.in.options which obviously just redirects to the home page. (your actual link is a href="../#cite.in.options")

This is by clicking the Documentation link on the home page, and then clicking Cite on the left frame.