Reference

Methods

Writer.translate()[source]

Do final translation of self.document into self.output. Called from write. Override in subclasses.

Usually done with a docutils.nodes.NodeVisitor subclass, in combination with a call to docutils.nodes.Node.walk() or docutils.nodes.Node.walkabout(). The NodeVisitor subclass must support all standard elements (listed in docutils.nodes.node_class_names) and possibly non-standard elements used by the current Reader as well.

NodeVisitor.dispatch_visit(node)[source]

Call self.”visit_ + node class name” with node as parameter. If the visit_... method does not exist, call self.unknown_visit.

NodeVisitor.dispatch_departure(node)[source]

Call self.”depart_ + node class name” with node as parameter. If the depart_... method does not exist, call self.unknown_departure.

Node.walk(visitor)[source]

Traverse a tree of Node objects, calling the dispatch_visit() method of visitor when entering each node. (The walkabout() method is similar, except it also calls the dispatch_departure() method before exiting each node.)

This tree traversal supports limited in-place tree modifications. Replacing one node with one or more nodes is OK, as is removing an element. However, if the node removed or replaced occurs after the current node, the old node will still be traversed, and any new nodes will not.

Within visit methods (and depart methods for walkabout()), TreePruningException subclasses may be raised (SkipChildren, SkipSiblings, SkipNode, SkipDeparture).

Parameter visitor: A NodeVisitor object, containing a visit implementation for each Node subclass encountered.

Return true if we should stop the traversal.

Node.walkabout(visitor)[source]

Perform a tree traversal similarly to Node.walk() (which see), except also call the dispatch_departure() method before exiting each node.

Parameter visitor: A NodeVisitor object, containing a visit and depart implementation for each Node subclass encountered.

Return true if we should stop the traversal.

HTML5Translator.default_visit(node)[source]

Initiate a new context to store inner HTML5 elements.

HTML5Translator.default_departure(node)[source]

Create the node’s corresponding HTML5 element and combine it with its stored context.

HTML5Translator.visit_Text(node)[source]

Bibliography

[GoF95]Gamma, Helm, Johnson, Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading, MA, USA, 1995.