Undocumented
| Method | __init__ |
Undocumented |
| Method | append |
Convenience function to open a tag, append text and close it immediatly. |
| Method | end |
No summary |
| Method | start |
Start formatted region |
| Method | text |
Append text @param text: text to be appended as string @implementation: optional for subclasses |
| Instance Variable | headings |
Undocumented |
| Instance Variable | max_level |
Undocumented |
| Method | _close |
Undocumented |
| Method | _split |
Undocumented |
| Instance Variable | _builder |
Undocumented |
zim.formats.Visitor.appendConvenience function to open a tag, append text and close it immediatly.
Can raise VisitorStop or VisitorSkip, see start() for the conditions.
| Parameters | |
| tag | the tag name |
| attrib | optional dict with attributes |
| text | formatted text |
| Unknown Field: implementation | |
optional for subclasses, default implementation calls start(), text(), and end() | |
zim.formats.Visitor.end| Parameters | |
| tag | the tag name |
| Raises | |
AssertionError | when tag does not match current state |
| Unknown Field: implementation | |
| optional for subclasses | |
zim.formats.Visitor.startStart formatted region
Visitor objects can raise two exceptions in this method to influence the tree traversal:
VisitorStop will cancel the current parsing, but without raising an error. So code implementing a visit method should catch this.VisitorSkip can be raised when the visitor wants to skip a node, and should prevent the implementation from further decending into this node| Parameters | |
| tag | the tag name |
| attrib | optional dict with attributes |
| Note | |
| If the visitor modifies the attrib dict on nodes, this will modify the tree. If this is not intended, the implementation needs to take care to copy the attrib to break the reference. | |
| Unknown Field: implementation | |
| optional for subclasses | |
zim.formats.Visitor.text| Parameters | |
| text | text to be appended as string |
| Unknown Field: implementation | |
| optional for subclasses | |