inukshuk / jekyll-scholar

jekyll extensions for the blogging scholar
MIT License
1.12k stars 101 forks source link

provide references in CSL json/yaml instead of bib #253

Open benswift opened 5 years ago

benswift commented 5 years ago

I generate my references file using Zotero's better bibtex extension. My references use some of the less common entry types, e.g. speech.

Since bibtex has a much smaller set of types, these speeches get turned into @unpublished in my bibfile, so that they don't get styled properly (for citation styles which support speech, anyway).

Zotero has the ability to generate the reference file as CSL directly (either JSON or YAML). Is it possible to get jekyll-scholar to read this references-csl.json directly, rather than having to go through the Zotero -> references.bib -> jekyll-scholar process? This process will always be problematic due to bibtex's impoverished ontology (compared to CSL).

inukshuk commented 5 years ago

This is not implemented at the moment, no. It would seem to be easy to add support for this, because jekyll-scholar converts the BibTeX input to CSL JSON for processing anyway, but, on the other hand, many of the features of jekyll-scholar are built on the bibtex-ruby API (e.g., using string queries in bibliography tag, input filters etc.). For that reason, I would think that the easiest way to do this have jekyll-scholar convert the CSL JSON to BibTeX internally, trying to preserve all the information.

If you, or anyone else, would like to take a stab at this, I would suggest to check the file extension around here and, in case of JSON input, parse the JSON and construct a BibTeX::Bibliography changing as little as possible so that .to_citeproc later on produces essentially the same JSON as the original.

A 'cleaner' solution, having jekyll-scholar use CSL JSON internally is probably not feasible (it would probably be better to create a jekyll-scholar spin-off based exclusively on CSL input).

benswift commented 5 years ago

Ok, no worries - thanks for the helpful pointers. I'm not sure I'm able to do a PR right away (sorry!) but will keep it in mind.

I agree that the spinoff is probably be a better option long-term (given that it feels a bit gross to abuse the innards to temporarily hold the CSL data and make sure nothing gets garbled in the csl -> bibtex -> csl round trip.