Hi Nicolas and all, Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:
> Richard Lawrence <richard.lawre...@berkeley.edu> writes: > >> Yes, this is my understanding, too. In particular, there does not seem >> to be an Elisp CSL library, and it would be a lot of work to write >> one. > > Here is a genuine question: what is the difficult part, or if there is > none, the longer parts of the work? AFAIU, CSL is XML and we can use > libxml for the low-level parsing. I can't speak to how difficult it would really be. But I do think it would be a lot of work, and tedious, unglamorous work at that. Essentially it means implementing the CSL specification: http://docs.citationstyles.org/en/stable/specification.html The specification describes the XML format for CSL styles, which IIUC are something like XSLT programs: they describe how to transform an input document tree into an output document tree. So, implementing CSL is something like implementing a very special-purpose declarative programming language, which has to handle declarations about every detail of citation formatting (where to put periods, how to capitalize names like "von Neumann", whether to use "&" or a translation of "and" for the current locale, etc.). Lisp is a good language to do this kind of thing in, but parsing the XML is surely the easy part. > Could you give some examples of the UI offered by the citeproc-hs > library? The library I ended up wrapping is actually pandoc-citeproc, which is a fork of citeproc-hs (which seems to be unmaintained). pandoc-citeproc essentially exports one main function, processCites. This function transforms a Pandoc data structure containing Citation nodes into another Pandoc where the citations have been rendered into the text and the bibliography is appended at the end of the document. processCites also requires a list of references (read from a bibliography database, e.g. .bib files, via the readBiblioFile function) and a CSL style (read from a file via the readCSLFile function). So basically, the pandoc-citeproc API consists of these three functions: processCites, readBiblioFile, and readCSLFile. Best, Richard