class documentation

class document(Root, Structural, Element): (source)

View In Hierarchy

The document root element.

Do not instantiate this class directly; use docutils.utils.new_document() instead.

Method __getstate__ Return dict with unpicklable references removed.
Method __init__ Undocumented
Method asdom Return a DOM representation of this document.
Method copy Return a copy of self.
Method get​_decoration Undocumented
Method has​_name Undocumented
Method note​_anonymous​_target Undocumented
Method note​_autofootnote Undocumented
Method note​_autofootnote​_ref Undocumented
Method note​_citation Undocumented
Method note​_citation​_ref Undocumented
Method note​_explicit​_target Undocumented
Method note​_footnote Undocumented
Method note​_footnote​_ref Undocumented
Method note​_implicit​_target Undocumented
Method note​_indirect​_target Undocumented
Method note​_parse​_message Undocumented
Method note​_pending Undocumented
Method note​_refid Undocumented
Method note​_refname Undocumented
Method note​_source Undocumented
Method note​_substitution​_def Undocumented
Method note​_substitution​_ref Undocumented
Method note​_symbol​_footnote Undocumented
Method note​_symbol​_footnote​_ref Undocumented
Method note​_transform​_message Undocumented
Method set​_duplicate​_name​_id Undocumented
Method set​_id Undocumented
Method set​_name​_id​_map self.nameids maps names to IDs, while self.nametypes maps names to booleans representing hyperlink type (True==explicit, False==implicit). This method updates the mappings.
Instance Variable autofootnote​_refs List of auto-numbered footnote_reference nodes.
Instance Variable autofootnote​_start Initial auto-numbered footnote number.
Instance Variable autofootnotes List of auto-numbered footnote nodes.
Instance Variable citation​_refs Mapping of citation labels to lists of citation_reference nodes.
Instance Variable citations List of citation nodes.
Instance Variable current​_line Line number (1-based) of current_source.
Instance Variable current​_source Path to or description of the input source being processed.
Instance Variable decoration Document's decoration node.
Instance Variable footnote​_refs Mapping of footnote labels to lists of footnote_reference nodes.
Instance Variable footnotes List of manually-numbered footnote nodes.
Instance Variable id​_counter Numbers added to otherwise identical IDs.
Instance Variable ids Mapping of ids to nodes.
Instance Variable include​_log The current source's parents (to detect inclusion loops).
Instance Variable indirect​_targets List of indirect target nodes.
Instance Variable nameids Mapping of names to unique id's.
Instance Variable nametypes Mapping of names to hyperlink type (boolean: True => explicit, False => implicit.
Instance Variable parse​_messages System messages generated while parsing.
Instance Variable refids Mapping of ids to lists of referencing nodes.
Instance Variable refnames Mapping of names to lists of referencing nodes.
Instance Variable reporter System message generator.
Instance Variable settings Runtime settings data record.
Instance Variable substitution​_defs Mapping of substitution names to substitution_definition nodes.
Instance Variable substitution​_names Mapping of case-normalized substitution names to case-sensitive names.
Instance Variable symbol​_footnote​_refs List of symbol footnote_reference nodes.
Instance Variable symbol​_footnote​_start Initial symbol footnote symbol index.
Instance Variable symbol​_footnotes List of symbol footnote nodes.
Instance Variable transform​_messages System messages generated while applying transforms.
Instance Variable transformer Storage for transforms to be applied to this document.
Instance Variable _document Undocumented

Inherited from Element:

Class Method is​_not​_known​_attribute Returns True if and only if the given attribute is NOT recognized by this class.
Class Method is​_not​_list​_attribute Returns True if and only if the given attribute is NOT one of the basic list attributes defined for all Elements.
Method __add__ Undocumented
Method __contains__ Undocumented
Method __delitem__ Undocumented
Method __getitem__ Undocumented
Method __iadd__ Append a node or a list of nodes to self.children.
Method __len__ Undocumented
Method __radd__ Undocumented
Method __repr__ Undocumented
Method __setitem__ Undocumented
Method __unicode__ Undocumented
Method append Undocumented
Method append​_attr​_list For each element in values, if it does not exist in self[attr], append it.
Method astext Return a string representation of this Node.
Method attlist Undocumented
Method clear Undocumented
Method coerce​_append​_attr​_list First, convert both self[attr] and value to a non-string sequence type; if either is not already a sequence, convert it to a list of one element. Then call append_attr_list.
Method copy​_attr​_coerce No summary
Method copy​_attr​_concatenate No summary
Method copy​_attr​_consistent If replace is True or self[attr] is None, replace self[attr] with value. Otherwise, do nothing.
Method copy​_attr​_convert If attr is an attribute of self, set self[attr] to [self[attr], value], otherwise set self[attr] to value.
Method deepcopy Return a deep copy of self (also copying children).
Method delattr Undocumented
Method emptytag Undocumented
Method endtag Undocumented
Method extend Undocumented
Method first​_child​_matching​_class Return the index of the first child whose class exactly matches.
Method first​_child​_not​_matching​_class Return the index of the first child whose class does not match.
Method get Undocumented
Method get​_language​_code Return node's language tag.
Method hasattr Undocumented
Method index Undocumented
Method insert Undocumented
Method is​_not​_default Undocumented
Method non​_default​_attributes Undocumented
Method note​_referenced​_by Note that this Element has been referenced by its name name or id id.
Method pformat Return an indented pseudo-XML representation, for test purposes.
Method pop Undocumented
Method remove Undocumented
Method replace Replace one child Node with another child or children.
Method replace​_attr If self[attr] does not exist or force is True or omitted, set self[attr] to value, otherwise do nothing.
Method replace​_self Replace self node with new, where new is a node or a list of nodes.
Method set​_class Add a new class to the "classes" attribute.
Method setdefault Undocumented
Method shortrepr Undocumented
Method starttag Undocumented
Method update​_all​_atts Updates all attributes from node or dictionary dict_.
Method update​_all​_atts​_coercion Updates all attributes from node or dictionary dict_.
Method update​_all​_atts​_concatenating Updates all attributes from node or dictionary dict_.
Method update​_all​_atts​_consistantly Updates all attributes from node or dictionary dict_.
Method update​_all​_atts​_convert Updates all attributes from node or dictionary dict_.
Method update​_basic​_atts Update basic attributes ('ids', 'names', 'classes', 'dupnames', but not 'source') from node or dictionary dict_.
Class Variable basic​_attributes List attributes which are defined for every Element-derived class instance and can be safely transferred to a different node.
Class Variable child​_text​_separator Separator for child nodes, used by astext() method.
Class Variable known​_attributes List attributes that are known to the Element base class.
Class Variable list​_attributes List attributes, automatically initialized to empty lists for all nodes.
Class Variable local​_attributes A list of class-specific attributes that should not be copied with the standard attributes when replacing a node.
Instance Variable attributes Dictionary of attribute {name: value}.
Instance Variable children List of child nodes (elements and/or Text).
Instance Variable rawsource The raw text from which this element was constructed.
Instance Variable referenced Undocumented
Instance Variable tagname The element generic identifier. If None, it is set as an instance attribute to the name of the class.
Method _dom​_node Undocumented

Inherited from Node (via Element):

Method __bool__ Node instances are always true, even if they're empty. A node is more than a simple container. Its boolean "truth" does not depend on having one or more subnodes in the doctree.
Method __str__ Undocumented
Method document​.setter Undocumented
Method next​_node Return the first node in the iterable returned by traverse(), or None if the iterable is empty.
Method setup​_child Undocumented
Method traverse Return an iterable containing
Method walk No summary
Method walkabout Perform a tree traversal similarly to Node.walk() (which see), except also call the dispatch_departure() method before exiting each node.
Class Variable line The line number (1-based) of the beginning of this Node in source.
Class Variable parent Back-reference to the Node immediately containing this Node.
Class Variable source Path or description of the input source which generated this Node.
Property document Return the document node at the root of the tree containing this Node.
Method _all​_traverse Return iterator that doesn't check for a condition.
Method _fast​_traverse Return iterator that only supports instance checks.
Method _traverse Return iterator over nodes following self. See traverse().
def __getstate__(self): (source)
Return dict with unpicklable references removed.
def __init__(self, settings, reporter, *args, **kwargs): (source)

Undocumented

def asdom(self, dom=None): (source)
Return a DOM representation of this document.
def copy(self): (source)
Return a copy of self.
def get_decoration(self): (source)

Undocumented

def has_name(self, name): (source)

Undocumented

def note_anonymous_target(self, target): (source)

Undocumented

def note_autofootnote(self, footnote): (source)

Undocumented

def note_autofootnote_ref(self, ref): (source)

Undocumented

def note_citation(self, citation): (source)

Undocumented

def note_citation_ref(self, ref): (source)

Undocumented

def note_explicit_target(self, target, msgnode=None): (source)

Undocumented

def note_footnote(self, footnote): (source)

Undocumented

def note_footnote_ref(self, ref): (source)

Undocumented

def note_implicit_target(self, target, msgnode=None): (source)

Undocumented

def note_indirect_target(self, target): (source)

Undocumented

def note_parse_message(self, message): (source)

Undocumented

def note_pending(self, pending, priority=None): (source)

Undocumented

def note_refid(self, node): (source)

Undocumented

def note_refname(self, node): (source)

Undocumented

def note_source(self, source, offset): (source)

Undocumented

def note_substitution_def(self, subdef, def_name, msgnode=None): (source)

Undocumented

def note_substitution_ref(self, subref, refname): (source)

Undocumented

def note_symbol_footnote(self, footnote): (source)

Undocumented

def note_symbol_footnote_ref(self, ref): (source)

Undocumented

def note_transform_message(self, message): (source)

Undocumented

def set_duplicate_name_id(self, node, id, name, msgnode, explicit): (source)

Undocumented

def set_id(self, node, msgnode=None, suggested_prefix=''): (source)

Undocumented

def set_name_id_map(self, node, id, msgnode=None, explicit=None): (source)

`self.nameids` maps names to IDs, while `self.nametypes` maps names to booleans representing hyperlink type (True==explicit, False==implicit). This method updates the mappings. The following state transition table shows how `self.nameids` ("ids") and `self.nametypes` ("types") change with new input (a call to this method), and what actions are performed ("implicit"-type system messages are INFO/1, and "explicit"-type system messages are ERROR/3): ==== ===== ======== ======== ======= ==== ===== ===== Old State Input Action New State Notes ----------- -------- ----------------- ----------- ----- ids types new type sys.msg. dupname ids types ==== ===== ======== ======== ======= ==== ===== ===== - - explicit - - new True - - implicit - - new False None False explicit - - new True old False explicit implicit old new True None True explicit explicit new None True old True explicit explicit new,old None True [#]_ None False implicit implicit new None False old False implicit implicit new,old None False None True implicit implicit new None True old True implicit implicit new old True ==== ===== ======== ======== ======= ==== ===== ===== .. [#] Do not clear the name-to-id map or invalidate the old target if both old and new targets are external and refer to identical URIs. The new target is invalidated regardless.

autofootnote_refs: list = (source)
List of auto-numbered footnote_reference nodes.
autofootnote_start: int = (source)
Initial auto-numbered footnote number.
autofootnotes: list = (source)
List of auto-numbered footnote nodes.
citation_refs: dict = (source)
Mapping of citation labels to lists of citation_reference nodes.
citations: list = (source)
List of citation nodes.
current_line = (source)
Line number (1-based) of current_source.
current_source = (source)
Path to or description of the input source being processed.
decoration = (source)
Document's decoration node.
footnote_refs: dict = (source)
Mapping of footnote labels to lists of footnote_reference nodes.
footnotes: list = (source)
List of manually-numbered footnote nodes.
id_counter = (source)
Numbers added to otherwise identical IDs.
ids: dict = (source)
Mapping of ids to nodes.
include_log: list = (source)
The current source's parents (to detect inclusion loops).
indirect_targets: list = (source)
List of indirect target nodes.
nameids: dict = (source)
Mapping of names to unique id's.
nametypes: dict = (source)
Mapping of names to hyperlink type (boolean: True => explicit, False => implicit.
parse_messages: list = (source)
System messages generated while parsing.
refids: dict = (source)
Mapping of ids to lists of referencing nodes.
refnames: dict = (source)
Mapping of names to lists of referencing nodes.
reporter = (source)
System message generator.
settings = (source)
Runtime settings data record.
substitution_defs: dict = (source)
Mapping of substitution names to substitution_definition nodes.
substitution_names: dict = (source)
Mapping of case-normalized substitution names to case-sensitive names.
symbol_footnote_refs: list = (source)
List of symbol footnote_reference nodes.
symbol_footnote_start: int = (source)
Initial symbol footnote symbol index.
symbol_footnotes: list = (source)
List of symbol footnote nodes.
transform_messages: list = (source)
System messages generated while applying transforms.
transformer = (source)
Storage for transforms to be applied to this document.
_document = (source)

Undocumented