Pybtex Extensions

New Text Elements

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

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.

class sphinxcontrib.bibtex.richtext.ReferenceInfo

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

TypeVar('ReferenceInfo') 的别名

New Template Nodes

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

Join text fragments together.

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

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)[源代码]

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)[源代码]

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

document: document

Current docutils document.

key: str

Citation key.

refname: str

Citation reference name.

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

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

render(backend: BaseBackend)[源代码]

Render this Text into markup.

参数:

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)[源代码]

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

builder: Builder

The Sphinx builder.

citation_id: str

Unique id of the citation within the bibliography.

fromdocname: str

Document name of the citation reference.

post_text: str

Text to come after citation.

pre_text: str

Text to come before citation.

title: str

Title attribute for reference node.

todocname: str

Document name of the bibliography.

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

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

render(backend: BaseBackend) List[Element][源代码]

Render this Text into markup.

参数:

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

New Names Styles

class sphinxcontrib.bibtex.style.names.last.LastNameStyle[源代码]

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

format(person, abbr=True)[源代码]

Format last names.