Package docutils :: Module nodes
[show private | hide private]
[frames | no frames]

Module docutils.nodes

Docutils document tree element class library.

Classes in CamelCase are abstract base classes or auxiliary classes. The one exception is Text, for a text (PCDATA) node; uppercase is used to differentiate from element classes. Classes in lower_case_with_underscores are element classes, matching the XML element generic identifiers in the DTD.

The position of each node (the level at which it can occur) is significant and is represented by abstract base classes (Root, Structural, Body, Inline, etc.). Certain transformations will be easier because we can use isinstance(node, base_class) to determine the position of the node in the hierarchy.


Classes
abbreviation  
acronym  
address  
Admonition  
admonition  
attention  
attribution  
author  
authors  
BackLinkable  
Bibliographic  
block_quote  
Body  
bullet_list  
caption  
caution  
citation  
citation_reference  
classifier  
colspec  
comment  
contact  
copyright  
danger  
date  
decoration  
Decorative  
definition  
definition_list  
definition_list_item  
description  
docinfo  
doctest_block  
document  
Element Element is the superclass to all specific elements.
emphasis  
entry  
enumerated_list  
error  
field  
field_body  
field_list  
field_name  
figure  
FixedTextElement An element which directly contains preformatted text.
footer  
footnote  
footnote_reference  
General  
generated  
GenericNodeVisitor Generic "Visitor" abstract superclass, for simple traversals.
header  
hint  
image  
important  
Inline  
inline  
Invisible Internal elements that don't appear in output.
label  
Labeled Contains a label as its first element.
legend  
line_block  
list_item  
literal  
literal_block  
Node Abstract base class of nodes in a document tree.
NodeVisitor "Visitor" pattern [GoF95] abstract superclass implementation for document tree traversals.
note  
option  
option_argument  
option_group  
option_list  
option_list_item  
option_string  
organization  
paragraph  
Part  
pending The "pending" element is used to encapsulate a pending operation: the operation (transform), the point at which to apply it, and any data it requires.
PreBibliographic Category of Node which may occur before Bibliographic Nodes.
PreDecorative Category of Node which may occur before Decorative Nodes.
problematic  
raw Raw data that is to be passed untouched to the Writer.
reference  
Referential  
Resolvable  
revision  
Root  
row  
rubric  
section  
Sequential  
sidebar Sidebars are like miniature, parallel documents that occur inside other documents, providing related or reference material.
SparseNodeVisitor Base class for sparse traversals, where only certain node types are of interest.
Special Special internal body elements.
status  
strong  
Structural  
subscript  
substitution_definition  
substitution_reference  
subtitle  
superscript  
system_message  
table  
target  
Targetable  
tbody  
term  
Text Instances are terminal nodes (leaves) containing text only; no child nodes or attributes.
TextElement An element which directly contains text.
tgroup  
thead  
tip  
title  
title_reference  
Titular  
topic Topics are terminal, "leaf" mini-sections, like block quotes with titles, or textual figures.
transition  
TreeCopyVisitor Make a complete copy of a tree or branch, including element attributes.
version  
warning  

Exceptions
NodeFound Raise to indicate that the target of a search has been found.
SkipChildren Do not visit any children of the current node.
SkipDeparture Do not call the current node's depart_... method.
SkipNode Do not visit the current node's children, and do not call the current node's depart_... method.
SkipSiblings Do not visit any more siblings (to the right) of the current node.
TreePruningException Base class for NodeVisitor-related tree pruning exceptions.

Function Summary
  dupname(node)
  fully_normalize_name(name)
Return a case- and whitespace-normalized name.
  make_id(string)
Convert string into an identifier and return it.
  whitespace_normalize_name(name)
Return a whitespace-normalized name.

Variable Summary
list node_class_names = ['Text', 'abbreviation', 'acronym', '...

Function Details

fully_normalize_name(name)

Return a case- and whitespace-normalized name.

make_id(string)

Convert string into an identifier and return it.

Docutils identifiers will conform to the regular expression [a-z](-?[a-z0-9]+)*. For CSS compatibility, identifiers (the "class" and "id" attributes) should have no underscores, colons, or periods. Hyphens may be used.

  • The HTML 4.01 spec defines identifiers based on SGML tokens:

    ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

  • However the CSS1 spec defines identifiers based on the "name" token, a tighter interpretation ("flex" tokenizer notation; "latin1" and "escape" 8-bit characters have been replaced with entities):

    unicode     \[0-9a-f]{1,4}
    latin1      [¡-ÿ]
    escape      {unicode}|\[ -~¡-ÿ]
    nmchar      [-a-z0-9]|{latin1}|{escape}
    name        {nmchar}+
    

The CSS1 "nmchar" rule does not include underscores ("_"), colons (":"), or periods ("."), therefore "class" and "id" attributes should not contain these characters. They should be replaced with hyphens ("-"). Combined with HTML's requirements (the first character must be a letter; no "unicode", "latin1", or "escape" characters), this results in the [a-z](-?[a-z0-9]+)* pattern.

whitespace_normalize_name(name)

Return a whitespace-normalized name.

Variable Details

node_class_names

Type:
list
Value:
['Text',
 'abbreviation',
 'acronym',
 'address',
 'admonition',
 'attention',
 'attribution',
 'author',
...                                                                    

Generated by Epydoc 2.0 on Tue Jul 22 05:30:17 2003 http://epydoc.sf.net