Cached Information

Classes and methods to maintain any 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

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

bibliographies

Each bibliography directive is assigned an id of the form bibtex-bibliography-xxx. This dict maps each such 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

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

_enum_count

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

add_cited(key, docname)[source]

Add the given key to the set of cited keys for docname.

Parameters:
  • key (str) – The citation key.
  • docname (str) – The document name.
get_all_cited_keys()[source]

Yield all citation keys, sorted first by document (alphabetical), then by citation order in the document.

get_enum_count(docname)[source]

Get enumeration list counter for document docname.

get_label_from_key(key)[source]

Return label for the given key.

inc_enum_count(docname)[source]

Increment enumeration list counter for document docname.

is_cited(key)[source]

Return whether the given key is cited in any document.

Parameters:key (str) – The citation key.
purge(docname)[source]

Remove all information related to docname.

Parameters:docname (str) – The document name.
set_enum_count(docname, value)[source]

Set enumeration list counter for document docname to value.

class sphinxcontrib.bibtex.cache.BibfileCache(mtime=None, data=None)[source]

Contains information about a parsed .bib file.

mtime

A float representing the modification time of the .bib file when it was last parsed.

data

A pybtex.database.BibliographyData containing the parsed .bib file.

class sphinxcontrib.bibtex.cache.BibliographyCache(docname=None, bibfiles=None, style=None, list_='citation', enumtype='arabic', start=1, labels=None, encoding=None, curly_bracket_strip=True, labelprefix='', filter_=None)[source]

Contains information about a bibliography directive.

docname

A str containing the name of the document in which the directive occurs. We need this information during the Sphinx event env-purge-doc.

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.

filter_

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

Project Versions

Previous topic

New Doctree Transforms

Next topic

Changes

This Page