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.

get_all_cited_keys(docnames)[source]

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.

get_label_from_key(key)[source]

Return label for the given key.

merge(docnames, other)[source]

Merge information from other cache related to docnames.

Parameters
  • docnames (str) – The document names.

  • other (Cache) – The other cache.

new_foot_current_id(env)[source]

Generate a new id for the given build environment.

purge(docname)[source]

Remove all information related to docname.

Parameters

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.

bibfiles

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

style

The bibtex style.

list_

The list type.

enumtype

The sequence type (only used for enumerated lists).

start

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

labels

Maps citation keys to their final labels.

labelprefix

This bibliography’s string prefix for pybtex generated labels.

keyprefix

This bibliography’s string prefix for citation keys.

filter_

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