class documentation

class DocInfo(Transform): (source)

View In Hierarchy

This transform is specific to the reStructuredText markup syntax; see "Bibliographic Fields" in the reStructuredText Markup Specification for a high-level description. This transform should be run after the DocTitle transform.

Given a field list as the first non-comment element after the document title and subtitle (if present), registered bibliographic field names are transformed to the corresponding DTD elements, becoming child elements of the "docinfo" element (except for a dedication and/or an abstract, which become "topic" elements after "docinfo").

For example, given this document fragment after parsing:

<document>
    <title>
        Document Title
    <field_list>
        <field>
            <field_name>
                Author
            <field_body>
                <paragraph>
                    A. Name
        <field>
            <field_name>
                Status
            <field_body>
                <paragraph>
                    $RCSfile$
    ...

After running the bibliographic field list transform, the resulting document tree would look like this:

<document>
    <title>
        Document Title
    <docinfo>
        <author>
            A. Name
        <status>
            frontmatter.py
    ...

The "Status" field contained an expanded RCS keyword, which is normally (but optionally) cleaned up by the transform. The sole contents of the field body must be a paragraph containing an expanded RCS keyword of the form "$keyword: expansion text $". Any RCS keyword can be processed in any bibliographic field. The dollar signs and leading RCS keyword name are removed. Extra processing is done for the following RCS keywords:

  • "RCSfile" expands to the name of the file in the RCS or CVS repository, which is the name of the source file with a ",v" suffix appended. The transform will remove the ",v" suffix.

  • "Date" expands to the format "YYYY/MM/DD hh:mm:ss" (in the UTC time zone). The RCS Keywords transform will extract just the date itself and transform it to an ISO 8601 format date, as in "2000-12-31".

    (Since the source file for this text is itself stored under CVS, we can't show an example of the "Date" RCS keyword because we can't prevent any RCS keywords used in this explanation from being expanded. Only the "RCSfile" keyword is stable; its expansion text changes only if the file name changes.)

Method apply Override to apply the transform to the document tree.
Method authors​_from​_bullet​_list Undocumented
Method authors​_from​_one​_paragraph Return list of Text nodes for authornames.
Method authors​_from​_paragraphs Undocumented
Method check​_compound​_biblio​_field Undocumented
Method check​_empty​_biblio​_field Undocumented
Method extract​_authors Undocumented
Method extract​_bibliographic Undocumented
Class Variable biblio​_nodes Canonical field name (lowcased) to node class name mapping for bibliographic fields (field_list).
Class Variable default​_priority Numerical priority of this transform, 0 through 999 (override).
Class Variable rcs​_keyword​_substitutions Undocumented

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 authors_from_bullet_list(self, field): (source)

Undocumented

def authors_from_one_paragraph(self, field): (source)

Return list of Text nodes for authornames.

The set of separators is locale dependent (default: ";"- or ",").

def authors_from_paragraphs(self, field): (source)

Undocumented

def check_compound_biblio_field(self, field, name): (source)

Undocumented

def check_empty_biblio_field(self, field, name): (source)

Undocumented

def extract_authors(self, field, name, docinfo): (source)

Undocumented

def extract_bibliographic(self, field_list): (source)

Undocumented

biblio_nodes = (source)
Canonical field name (lowcased) to node class name mapping for bibliographic fields (field_list).
default_priority: int = (source)
Numerical priority of this transform, 0 through 999 (override).
rcs_keyword_substitutions = (source)

Undocumented