class documentation

class Footnotes(Transform): (source)

View In Hierarchy

Assign numbers to autonumbered footnotes, and resolve links to footnotes, citations, and their references.

Given the following document as input:

<document>
    <paragraph>
        A labeled autonumbered footnote referece:
        <footnote_reference auto="1" id="id1" refname="footnote">
    <paragraph>
        An unlabeled autonumbered footnote referece:
        <footnote_reference auto="1" id="id2">
    <footnote auto="1" id="id3">
        <paragraph>
            Unlabeled autonumbered footnote.
    <footnote auto="1" id="footnote" name="footnote">
        <paragraph>
            Labeled autonumbered footnote.

Auto-numbered footnotes have attribute auto="1" and no label. Auto-numbered footnote_references have no reference text (they're empty elements). When resolving the numbering, a label element is added to the beginning of the footnote, and reference text to the footnote_reference.

The transformed result will be:

<document>
    <paragraph>
        A labeled autonumbered footnote referece:
        <footnote_reference auto="1" id="id1" refid="footnote">
            2
    <paragraph>
        An unlabeled autonumbered footnote referece:
        <footnote_reference auto="1" id="id2" refid="id3">
            1
    <footnote auto="1" id="id3" backrefs="id2">
        <label>
            1
        <paragraph>
            Unlabeled autonumbered footnote.
    <footnote auto="1" id="footnote" name="footnote" backrefs="id1">
        <label>
            2
        <paragraph>
            Labeled autonumbered footnote.

Note that the footnotes are not in the same order as the references.

The labels and reference text are added to the auto-numbered footnote and footnote_reference elements. Footnote elements are backlinked to their references via "refids" attributes. References are assigned "id" and "refid" attributes.

After adding labels and reference text, the "auto" attributes can be ignored.

Method apply Override to apply the transform to the document tree.
Method number​_footnote​_references Assign numbers to autonumbered footnote references.
Method number​_footnotes Assign numbers to autonumbered footnotes.
Method resolve​_footnotes​_and​_citations Link manually-labeled footnotes and citations to/from their references.
Method resolve​_references Undocumented
Method symbolize​_footnotes Add symbols indexes to "[*]"-style footnotes and references.
Class Variable default​_priority Numerical priority of this transform, 0 through 999 (override).
Class Variable symbols Undocumented
Instance Variable autofootnote​_labels Keep track of unlabeled autonumbered footnotes.

Inherited from Transform:

Method __init__ Initial setup for in-place document transforms.
Instance Variable document The document tree to transform.
Instance Variable language Language module local to this document.
Instance Variable startnode Node from which to begin the transform. For many transforms which apply to the document as a whole, startnode is not set (i.e. its value is None).
def apply(self): (source)
Override to apply the transform to the document tree.
def number_footnote_references(self, startnum): (source)
Assign numbers to autonumbered footnote references.
def number_footnotes(self, startnum): (source)

Assign numbers to autonumbered footnotes.

For labeled autonumbered footnotes, copy the number over to corresponding footnote references.

def resolve_footnotes_and_citations(self): (source)
Link manually-labeled footnotes and citations to/from their references.
def resolve_references(self, note, reflist): (source)

Undocumented

def symbolize_footnotes(self): (source)
Add symbols indexes to "[*]"-style footnotes and references.
default_priority: int = (source)
Numerical priority of this transform, 0 through 999 (override).
symbols: list[str] = (source)

Undocumented

autofootnote_labels: list = (source)
Keep track of unlabeled autonumbered footnotes.