Skip to main content

Overview

The pybtex docutils backend allows BibTeX citations to be inserted into documentation generated by docutils.

Installation

For use with Sphinx, simply install sphinxcontrib-bibtex.

For use with pure docutils, install the module with pip install pybtex_docutils, or from source using pip install -e ..

Minimal Example

For use with Sphinx, refer to the sphinxcontrib-bibtex documentation.

For use with pure docutils, the module exposes a new simplebibliography directive, which will generate a citation for every entry in the specified bib files. This new directive is only intended for simple single document workflows that do not require the full power of Sphinx. You need exactly one of these directives in your document, placed at the location where you want the citations to appear (typically, at the end).

For example:

See  [Nelson1987]_ for an introduction to non-standard analysis.

.. simplebibliography:: refs.bib

where refs.bib might contain:

@Book{Nelson1987,
  author = {Edward Nelson},
  title = {Radically Elementary Probability Theory},
  publisher = {Princeton University Press},
  year = {1987}
}

Note that citation keys are used as labels. For this to work, it is thus necessary that all keys in your bib file are valid citation labels for docutils. In particular, they cannot contain colons. This limitation is lifted in sphinxcontrib-bibtex, which also provides many more citation features.

To use the directive, you have to write your own command script (there seems to be no other way currently to extend docutils). For instance:

#!/usr/bin/env python3
from docutils.parsers.rst import directives, Directive
from docutils.core import publish_cmdline, default_description

from pybtex_docutils import SimpleBibliography

description = ('Like rst2html5.py, but with .. simplebibliography support'
               + default_description)

if __name__ == '__main__':
    directives.register_directive("simplebibliography", SimpleBibliography)
    publish_cmdline(writer_name='html5', description=description)

You can then run this command as if you would run rst2html5.

Download files

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

Source Distribution

pybtex-docutils-1.0.2.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybtex_docutils-1.0.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file pybtex-docutils-1.0.2.tar.gz.

File metadata

  • Download URL: pybtex-docutils-1.0.2.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.9

File hashes

Hashes for pybtex-docutils-1.0.2.tar.gz
Algorithm Hash digest
SHA256 43aa353b6d498fd5ac30f0073a98e332d061d34fe619d3d50d1761f8fd4aa016
MD5 14e8936c354c8c94743363eedc4f2d3f
BLAKE2b-256 5482360c8d20d8fffdaac243d3b0d1633a037ea3af9a51aa47d7af5b0c059b49

See more details on using hashes here.

File details

Details for the file pybtex_docutils-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pybtex_docutils-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.9

File hashes

Hashes for pybtex_docutils-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6f9e3c25a37bcaac8c4f69513272706ec6253bb708a93d8b4b173f43915ba239
MD5 25c622e9c225390508ba3328d50a48a5
BLAKE2b-256 ef9bd14374c7ef41e8fcf214a7d563407d7f7215d82d3dab53b0329535d251b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page