Cached Information

Classes and methods to maintain any bibtex information that is stored outside the doctree.

class sphinxcontrib.bibtex.cache.Cache[source]

Global bibtex extension information cache. Stored in app.env.bibtex_cache, so must be picklable.

bibfiles = None

A dict mapping .bib file names (relative to the top source folder) to BibfileCache instances.

bibliographies = None

Each bibliography directive is assigned an id of the form bibtex-bibliography-xxx. This dict maps each docname to another dict which maps each id to information about the bibliography directive, BibliographyCache. We need to store this extra information separately because it cannot be stored in the bibliography nodes themselves.

cited = None

A dict mapping each docname to a set of citation keys.

enum_count = None

A dict mapping each docname to an int representing the current bibliography enumeration counter.

foot_cited = None

A dict mapping each docname to another dict which maps each id to a set of footnote keys.

foot_current_id = None

A dict mapping each docname to the currently active id.


Yield all citation keys for given docnames in order, then ordered by citation order.

get_bibliography_entries(docname, id_, warn, docnames)[source]

Return filtered bibliography entries, sorted by citation order.


Return label for the given key.

merge(docnames, other)[source]

Merge information from other cache related to docnames.

  • docnames (str) – The document names.

  • other (Cache) – The other cache.


Generate a new id for the given build environment.


Remove all information related to docname.


docname (str) – The document name.

class sphinxcontrib.bibtex.cache.BibliographyCache(bibfiles, style, list_, enumtype, start, labels, labelprefix, filter_, keyprefix)[source]

Contains information about a bibliography directive.


A list of strs containing the .bib file names (relative to the top source folder) that contain the references.


The bibtex style.


The list type.


The sequence type (only used for enumerated lists).


The first ordinal of the sequence (only used for enumerated lists).


Maps citation keys to their final labels.


This bibliography’s string prefix for pybtex generated labels.


This bibliography’s string prefix for citation keys.


An ast.AST node, containing the parsed filter expression.