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

CLI input format #187

Closed shaunc closed 5 years ago

shaunc commented 5 years ago

I was hoping to use this project to convert from identifiers (specified in various formats) to json data. However, I'm unable to figure out how to use an input plugin together with the cli. I'm not sure if this is a doc problem, or a feature limitation.

$ yarn global add citation-js
$ yarn global add @citation-js/plugin-isbn
$ citation-js --plugins isbn --text isbn:978-0918024565

Error: This format is not supported or recognized

I tried various ways of specifying the isbn #; it would seem that there is no mention in the docs. Some clarification would be helpful.

UPDATE The following seems to work:

citation-js --text 9780918024565 --plugins isbn --input-force-type @isbn/isbn-13

Still -- not clear in documentation (both "--input-force-type" and the particular type necessary are undocumented).

larsgw commented 5 years ago

Hi!

  1. Prefixes like isbn: are not supported, although I do have plans for them.
  2. I think I forgot to include hyphens in the ISBN pattern because the official order of hyphens is really complicated, but I can just make the pattern any sequence of digits and hyphens.
  3. The ISBN in the second example should work without --input-force-type though, I think. I'll see what's going on.
  4. The documentation is a bit outdated, I'll make that more of a priority.

However, I don't have time for any of this this week, sorry.

larsgw commented 5 years ago

Okay, the second example works for me without --input-force-type, and I've updated the rest in @citation-js/plugin-isbn@0.2.1.

shaunc commented 5 years ago

Thanks!