Pybtex Extensions

New Text Elements

class sphinxcontrib.bibtex.richtext.BaseReferenceText(info: ReferenceInfo, *parts: BaseText)[source]

Generic rich text element for citation references. Instances store some extra reference info that can be used when formatting. This base class renders its children without further formatting. Implementations must create a derivation from this class which overrides the render method to create the desired output. See for instance SphinxReferenceText.

sphinxcontrib.bibtex.richtext.ReferenceInfo

Generic type parameter for types that store reference information. To be implemented by clients. See for instance SphinxReferenceInfo.

alias of TypeVar(‘ReferenceInfo’)

New Template Nodes

sphinxcontrib.bibtex.style.template.join(sep='', sep2=None, last_sep=None, other=None)[source]

Join text fragments together.

sphinxcontrib.bibtex.style.template.sentence(capfirst=False, capitalize=False, add_period=True, sep=', ', sep2=None, last_sep=None, other=None)[source]

Join text fragments, capitalize the first letter, and add a period to the end.

sphinxcontrib.bibtex.style.template.names(role, sep='', sep2=None, last_sep=None, other=None)[source]

Return formatted names.

sphinxcontrib.bibtex.style.template.entry_label()

Node for inserting the label of a formatted entry.

sphinxcontrib.bibtex.style.template.reference()

Pybtex node for inserting a docutils reference node to a citation. The children of the node comprise the content of the reference, and any referencing information is stored in the reference_info key of the data. The data must also contain a style key pointing to the corresponding BaseReferenceStyle.

sphinxcontrib.bibtex.style.template.footnote_reference()

Pybtex node for inserting a footnote_reference docutils node. Any referencing information is stored in the reference_info key of the data. The data must also contain a style key pointing to the corresponding BaseReferenceStyle.

class sphinxcontrib.bibtex.style.template.FootReferenceInfo(key: str, document: docutils.nodes.document, refname: str)[source]

Tuple containing reference info to enable sphinx to resolve a footnote reference.

property document

Current docutils document.

property key

Citation key.

property refname

Citation reference name.

class sphinxcontrib.bibtex.style.template.FootReferenceText(info: ReferenceInfo, *parts: BaseText)[source]

Pybtex rich text class generating a docutils footnote_reference node to a citation for use with FootReferenceInfo.

render(backend: BaseBackend)[source]

Render this Text into markup.

Parameters

backend – The formatting backend (an instance of pybtex.backends.BaseBackend).

class sphinxcontrib.bibtex.style.template.SphinxReferenceInfo(builder: Builder, fromdocname: str, todocname: str, citation_id: str, title: str, pre_text: str, post_text: str)[source]

Tuple containing reference info to enable sphinx to resolve a reference to a citation.

property builder

The Sphinx builder.

property citation_id

Unique id of the citation within the bibliography.

property fromdocname

Document name of the citation reference.

property post_text

Text to come after citation.

property pre_text

Text to come before citation.

property title

Title attribute for reference node.

property todocname

Document name of the bibliography.

class sphinxcontrib.bibtex.style.template.SphinxReferenceText(info: ReferenceInfo, *parts: BaseText)[source]

Pybtex rich text class generating a docutils reference node to a citation for use with SphinxReferenceInfo.

render(backend: BaseBackend) List[Element][source]

Render this Text into markup.

Parameters

backend – The formatting backend (an instance of pybtex.backends.BaseBackend).

New Names Styles

class sphinxcontrib.bibtex.style.names.last.LastNameStyle[source]

A simple name style for formatting the last name of an author.

format(person, abbr=True)[source]

Format last names.