Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.
bdarcus edited this page Mar 24, 2011 · 4 revisions

Introduction

This is a Python implementation of the Citation Style Language.

API

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.

CiteProc and RDFa

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>
Clone this wiki locally