Home
This is a Python implementation of the Citation Style Language.
It presents a simple API that consists of the following basic functions:
- process_citation(csl, references)
- process_bibliography(csl, references)
The input data for "references" is a JSON array.
The internal model for the processed data is XHTML + RDFa. This has the benefit that it keeps both raw data and rendered content together, which facilitates some of the more complex processing. It also has a secondary benefit, which is that this model also can be serialized to present a very useful primary output format as well; one that retains all of the data in the finished rendered content. Hence, citeproc-py makes it possible to roundtrip citation metadata.
The processor functions by iterating through the CSL tree. When it generates output, it does so by creating an HTML + RDFa ElementTree object representation. If we had a simple CSL fragment like ...
<cs:text variable="title"/>
... then, a serialized version of the internal representation would look like:
<x:span property="dc:title">An Example Title</x:span>