loup-brun / hugo-cite

📝 Easily manage your bibliography and in-text citations with Hugo, the popular static-site generator.
https://labs.loupbrun.ca/hugo-cite/
Do What The F*ck You Want To Public License
105 stars 26 forks source link

CSL and multiple styles #21

Open HughP opened 3 years ago

HughP commented 3 years ago
  1. If I wanted to contribute another style how would this project enable a site designer to pick between the styles?

  2. CSL is in XML. Hugo has no capacity to read XML. Have you thought about any possibilities of converting the CSL.xml files to say something like CSV or JSON so they can be used in hugo? I'm brain storming and trying to figure out how this might work.

I used: https://www.convertjson.com/xml-to-json.htm to convert the APA csl.xml file to json from XML https://www.zotero.org/styles/apa-5th-edition

this would essentially make all the CSL variables "available" in JOSN, then we would just need to process these into Hugo or a defined html?

loup-brun commented 3 years ago

Implementing CSL (from JSON, which is a nice idea) would be very powerful, but I’m not sure if it's even possible given the declarative <if> / <else> blocks in the XML.

It may be possible, but it would be extremely verbose to implement and would imply re-writing a CSL implementation in Go/HTML syntax, almost certainly a no-go.

HughP commented 3 years ago

Is there a possibility of getting a config option or switch of some sort so that Hugo-cite can have more than one style? I like chicago more than APA, and would work on an implementation, but need a way to declare one style over the other,

HughP commented 3 years ago

Actually I see that there already is a way to declare one citation style over another in the cite shortcode. But I am thinking more globally, though I guess it doesn't really matter where the setting is... being a theme I would think it would be in a config.toml file.