citeproc-hs: A Citation Style Language implementation in Haskell

[ bsd3, library, text ] [ Propose Tags ]

citeproc-hs is a library for automatically formatting bibliographic reference citations into a variety of styles using a macro language called Citation Style Language (CSL). More details on CSL can be found here:

For the API documentation please see Text.CSL.

[Skip to Readme]


Automatic Flags

Choose the new smaller, split-up base package.


Run the textsuite.


Use Chris Putnam's Bibutils.


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees


Versions [RSS] 0.1, 0.2, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.3.9, 0.3.10
Dependencies base (>=3), containers, directory, filepath, hs-bibutils, hxt (>=8.1), mtl, syb [details]
License BSD-3-Clause
Author Andrea Rossato
Category Text
Home page
Uploaded by AndreaRossato at 2008-12-27T21:09:39Z
Distributions FreeBSD:0.3.10, NixOS:0.3.10
Downloads 18149 total (23 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for citeproc-hs-0.2

[back to package description]
% citeproc-hs - A Haskell Implementation of the Citation Style Language
% Andrea Rossato


[citeproc-hs] is a Haskell implementation of the Citation Style
Language ([CSL]).

[citeproc-hs] adds to [pandoc], the famous [Haskell] text processing
tool, a Bibtex like citation and bibliographic formatting and
generation facility.

[CSL] is an XML language for specifying citation and bibliographic
formatting, similar in principle to BibTeX `.bst` files or the binary
style files in commercial products like Endnote or Reference Manager.

[CSL] is used by [Zotero] for bibliographic style formatting, and the
huge number of [CSL] styles developed by the [Zotero] community can
can be downloaded from here:


There are plans to use CSL for adding bibliographic support to future
releases of [OpenOffice](

[citeproc-hs] can process and format citations according to a [CSL]
style, given a collection of references.

Natively [citeproc-hs] can only read [MODS] XML formattted
bibliographic databases. The Metadata Object Description Schema
([MODS]) is an XML format which is used by [bibutils] to interconvert
many different bibliographic database formats, like Bibtex, Endnote,
and others.

[bibutils] can be used to convert Bibtex and other bibliographic
databases to [MODS] collections, which can be thus read by

[bibutils] also exports a library and this library can be used by
[citeproc-hs] for reading the most widely used bibliographic
databases. This requires the installation of [hs-bibutils], the
Haskell bindings to [bibutils].

[citeproc-hs] is a library that exports functions to parse [CSL]
styles and [MODS] collections, to process lists of citation groups and
to format the processed output. The output is a Haskell data type that
can be further processed for conversion to any kind of formats (at the
present time plain ASCII and the pandoc] native format)

[pandoc] is a [Haskell] library for converting from one markup format to
another, and a command-line tool that uses this library. It can read
[markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX]; and
it can write [markdown], [reStructuredText], [HTML], [LaTeX], [ConTeXt],
[RTF], [DocBook XML], [OpenDocument XML], [ODT], [GNU Texinfo],
[MediaWiki markup], [groff man] pages, and [S5] HTML slide shows.


[citeproc-hs] can be downloaded from [Hackage]:


To get the darcs source run:

        darcs get


### Installing without bibutils support

[citeproc-hs] depends on [hxt], the Haskell XML Tool Box.

In order to install [citeproc-hs] you need to install [hxt] and its
dependencies. You can download everything from [Hackage]:


Every package downloaded form [Hackage] can be installed with these
simple commands:

        runhaskell Setup.lhs configure
        runhaskell Setup.lhs build
        runhaskell Setup.lhs install

This last step requires `root` privileges.

If you don't have `root` privileges you can install citeproc-hs and
*all* its dependencies locally with these commands:

        runhaskell Setup.lhs configure --user --prefix=$HOME
        runhaskell Setup.lhs build
        runhaskell Setup.lhs install --user

### Installing with bibutils support

Since [bibutils] doesn't build a shared object and doesn't install the
library, which is a static object used to compile the single
[bibutils] utilities, by default [citeproc-hs] is not built with
[bibutils] support.

If you succeeded in installing [bibutils] and [hs-bibutils], you can
enable [bibutils] by configuring with the `-fbibutils` flag:

        runhaskell Setup.lhs configure -fbibutils

and then build and install with:

        runhaskell Setup.lhs build
        runhaskell Setup.lhs install

Using citeproc-hs with Pandoc

If you want to use [citeproc-hs] with [pandoc] you need to install
[citeproc-hs] first, get the [pandoc] source code and compile it with
the `-f citeproc` flag:

        runhaskell Setup.hs configure -f citeproc
        runhaskell Setup.hs build
        runhaskell Setup.hs install

Citations are inserted like simple reference links:


where `Rossato2006` is the reference id (or citation key) used in the
bibliographic database.

Citation groups are also possible. Each citation is separated by a

    [Rossato2006; Pascuzzi2002]

The use of locators is also possible:

    [Rossato2006@ p. 10; Pascuzzi2002@ cap. 12]

To automatically format citations and generate the bibliography, run
[pandoc] with the `--csl` and `--biblio` flags:

    pandoc --csl cslStyle.csl --biblio modsCollection.mods text.markdown > text.html

Obviously you can export the text into any of the formats supported by

Some examples can be found in the `test` directory of the source tree.

You can try them with:

    pandoc --csl apa.csl --biblio modsCollection.xml --biblio-format mods test.markdown
    pandoc --csl apa.csl --biblio modsCollection.xml --biblio-format mods test_note.markdown


[Haddock] documentation for the exported API is available at the
following address:


Generating the [Haddock] documentation is troublesome with Cabal < (GHC-6.10.1 comes with Cabal-, because of this:


Known Issues

[citeproc-hs] is in an early stage of development and the [CSL]
implementation is not complete yet.

Specifically the following options are not implemented:

 - "hanging-indent"
 - "second-field-align"
 - "line-spacing"
 - "entry-spacing"

The [MODS] parser needs some refinement too.

Bug Reports

To submit bug reports you can use the Google code bug tracking system
available at the following address:



[Bruce D'Arcus], the author of [CSL], has been very kind and patient
with me when I was trying to understand the [CSL] schema, and provided
me with ideas, comments and suggestions that made it possible to come
to something usable.

[John MacFarlane], the author of [pandoc], has been very supportive of
the project and provided a lot of useful feed back, comments and


Andrea Rossato

`andrea.rossato at`

Links to Related Projects

:    <>

:    <>

:    <>

:    <>

:    <>


This software is released under a BSD-style license. See LICENSE for
more details.

This is an early, "alpha" release. It carries no warranties of any kind.

Copyright &copy; 2008 Andrea Rossato

[Bruce D'Arcus]:
[John MacFarlane]:

[DocBook XML]:
[OpenDocument XML]:
[MediaWiki markup]:
[groff man]:
[GNU Texinfo]: