Home | Trees | Index | Help |
---|
Package docutils :: Module nodes :: Class NodeVisitor |
|
GenericNodeVisitor
"Visitor" pattern [GoF95] abstract superclass implementation for document tree traversals.
Each node class has corresponding methods, doing nothing by
default; override individual methods for specific and useful
behaviour. The dispatch_visit()
method is called by
Node.walk()
upon entering a node. Node.walkabout()
also calls
the dispatch_departure()
method before exiting a node.
The dispatch methods call "visit_ + node class name" or "depart_ + node class name", resp.
This is a base class for visitors whose visit_... & depart_...
methods should be implemented for all node types encountered (such as
for docutils.writers.Writer
subclasses). Unimplemented methods will
raise exceptions.
For sparse traversals, where only certain node types are of interest,
subclass SparseNodeVisitor
instead. When (mostly or entirely) uniform
processing is desired, subclass GenericNodeVisitor
.
[GoF95] | Gamma, Helm, Johnson, Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading, MA, USA, 1995. |
Method Summary | |
---|---|
__init__(self,
document)
| |
Call self."depart_ + node class name" with node as
parameter. | |
Call self."visit_ + node class name" with node as
parameter. | |
Called before exiting unknown Node types. | |
Called when entering unknown Node types. |
Class Variable Summary | |
---|---|
tuple |
optional = ()
|
Method Details |
---|
dispatch_departure(self, node)Call self."depart_ + node class name" with |
dispatch_visit(self, node)Call self."visit_ + node class name" with |
unknown_departure(self, node)Called before exiting unknown Raise exception unless overridden. |
unknown_visit(self, node)Called when entering unknown Raise an exception unless overridden. |
Class Variable Details |
---|
optional
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Wed Jul 12 11:20:41 2006 | http://epydoc.sf.net |