Fix reference resolver, and add option to output BibTeX with the CrossRef API
Created by: jdherman
Thanks for making this library! It's a great idea.
Two suggestions in this pull request:
- The resolver for the
--resolved_references
option was broken. I switched it to the updatedhttp://search.labs.crossref.org/dois?q=#{...}
. If found, it sticks the DOI and score into the XML output. - Add a new
extract-bib
command, which first finds the resolved reference DOIs, and then uses the REST API to fetch the bibtex citation athttp://api.crossref.org/works/#{doi}/transform/application/x-bibtex
. This does not affect the existing XML output with theextract
command. It outputs the bibtex citations to{file_base}.bib
. It's a little slow with all the fetching, so I added verbose output to make sure everything's working ok. Only the refs withscore > 1
are printed to the bibtex file.
I'd love to see both of these in the gem someday. I think (2) especially could be extended to any format supported by the new CrossRef API. Thanks again!