Skip to main content

Citations and bibliography formatter

Project description

Note: This is a forked package, forked from https://github.com/brechtm/citeproc-py

Please use https://pypi.org/project/citeproc-py/ instead.

citeproc-py

PyPI Build status Code coverage

citeproc-py is a CSL processor for Python. It aims to implement the CSL 1.0.1 specification. citeproc-py can output styled citations and bibliographies in a number of different output formats. Currently supported are plain text, reStructuredText and HTML. Other formats can be added easily.

citeproc-py uses semantic versioning. Currently, its major version number is still at 0, meaning the API is not yet stable. However, you should not expect to see any major API changes soon.

Requirements

citeproc-py supports Python 3.6 and up. It depends on lxml for parsing and navigating the CSL style and locale files.

Installation

The recommended way of installing citeproc-py is by using pip:

pip install citeproc-py

If lxml isn’t installed, pip will try to install it for you.

If you insist, you can manually install citeproc-py from distribution packages hosted at PyPI. Please ignore the release archives offered by GitHub.

Getting Started

To get started with citeproc-py, take a look at the examples under examples/. Two examples are provided, one parsing references from a JSON representation of references as supported by citeproc-js, another parsing the references from a BibTeX file. Both show and explain how to cite references and render the bibliography.

CSL Compatibility

Currently, citeproc-py passes almost 60% of the (relevant) tests in the citeproc-test suite. However, it is more than 60% complete, as citeproc-py doesn’t take care of double spaces and repeated punctuation marks yet, making a good deal of the tests fail. In addition, the following features have not yet been implemented (there are probably some I forgot though):

  • disambiguation/year-suffix

  • et-al-subsequent-min/et-al-subsequent-use-first

  • collapsing

  • punctuation-in-quote

  • display

Also, some citeproc-js functionality that is not part of the CSL spec is not (yet) supported:

  • raw dates

  • static-ordering

  • literal names

Running the Tests

First clone the citeproc-test suite so that it sits next to the citeproc-py directory. Now you can run citeproc-test.py (in the tests directory). Run citeproc-test.py --help to see its usage information.

Changelog

Release 0.6.0 (2021-05-27)

Bug fixes

  • Various issues on Windows: testing, explicit utf-8 encoding

  • Strings with unescaped declared r”aw”

Other changes:

  • Removed support for Python 2.7, 3.5 and added for 3.9

  • Travis CI is removed in favor of GitHub actions testing across all 3 major OSes (MacOS, Windows, GNU/Linux Ubuntu)

  • CSL test-suite progressed from 5779a8c to c3db429

Release 0.5.1 (2020-03-06)

Bug fixed:

  • avoid rnc2rng 2.6.2 which breaks installation of citeproc-py

Release 0.5.0 (2020-02-09)

Enhancements:

  • handle commas and ampersands in a functional style

  • Number: handle commas and ampersands

  • added symbol for textquotesingle

  • specify fallback locales for fr-CA and es-CL

  • improved page number and ranges parsing

Bug fixed:

  • don’t fail on empty page ranges (#90) (bbm)

  • detect end of file while parsing incorrect bib (#59) (John Vandenberg)

Other changes:

  • Removed 3.2-3.4 and added 3.7, 3.8 to supported Pythons

  • Refactored locales handling

Release 0.4.0 (2017-06-23)

New features:

  • allow specifying the encoding of a BibTeX database file (#20 and #25)

  • BibTeX ‘month’ field: support integers and “<month> <day>” values

  • BibTeX ‘pages’ field: support “10”, “10+”, “10-12” and “10–12” formats

  • BibTeX entry types: map the non-standard ‘thesis’ and ‘report’ entries

  • update the CSL schema to version 1.0.1 (#5)

  • update the CSL locales to commit 49bf3fc0

Bug fixed:

  • avoid crash when there is nothing to affix (David Lesieur)

  • fix BibTeX month to CSL month mapping (#24)

  • strip leading/trailing whitespace from BibTeX values (#37)

Release 0.3.0 (2014-11-07)

Major improvements to the BibTeX parser:

  • split names into parts and assign them to the equivalent CSL name parts

  • fixed handling of accent macros and escaped characters

  • more compatible (La)TeX macro handling in general (but still basic)

  • handle standard Computer Modern ligatures such as –, —, and <<

  • added unit tests for the BibTeX and LaTeX parsers

Other changes:

  • disable RelaxNG validation of CSL styles by default (API change)

Release 0.2.0 (2014-10-25)

  • bad cite callback function can determine how a bad cite is displayed (hetsch)

  • added option to disable RelaxNG validation (Jasper Op de Coul)

  • distutils was replaced with setuptools (Joshua Carp)

  • bug fixes (Yaroslav Halchenko, David Lesieur)

  • CitationStylesBibliography.bibliography() now returns the list of entries

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

up-branch-citeproc-py-0.6.0.post1.tar.gz (151.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file up-branch-citeproc-py-0.6.0.post1.tar.gz.

File metadata

  • Download URL: up-branch-citeproc-py-0.6.0.post1.tar.gz
  • Upload date:
  • Size: 151.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for up-branch-citeproc-py-0.6.0.post1.tar.gz
Algorithm Hash digest
SHA256 56766f2d11119b3586e3ba7201af2ea98ef8fd7f337f9d44b2d050c195fc86f9
MD5 c18352ee87a2ac446af1a523e8e89b2e
BLAKE2b-256 28e875bf4d506e646cd2179e9b1717b694981c6832e8743dc0c7f5646864d52d

See more details on using hashes here.

File details

Details for the file up_branch_citeproc_py-0.6.0.post1-py3-none-any.whl.

File metadata

  • Download URL: up_branch_citeproc_py-0.6.0.post1-py3-none-any.whl
  • Upload date:
  • Size: 208.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for up_branch_citeproc_py-0.6.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 02afc42e90669f23ef1d39b8bfd557df10ed8daec2243086de75dee2f642e3fd
MD5 14dc7f631c5c7eaaae5ad3935d488a8d
BLAKE2b-256 92d8293c39ef2e513d65bb253e7fc8ee2f83a0efd323d0fe38b6981b4177ac7c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page