class documentation

class HeadingSplitter(Visitor): (source)

View In Hierarchy

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
def __init__(self, max_level=None): (source)

Undocumented

def append(self, tag, attrib=None, text=None): (source)

Convenience function to open a tag, append text and close it immediatly.

Can raise VisitorStop or VisitorSkip, see start() for the conditions.

Parameters
tagthe tag name
attriboptional dict with attributes
textformatted text
Unknown Field: implementation
optional for subclasses, default implementation calls start(), text(), and end()
def end(self, tag): (source)
End formatted region
Parameters
tagthe tag name
Raises
AssertionErrorwhen tag does not match current state
Unknown Field: implementation
optional for subclasses
def start(self, tag, attrib=None): (source)

Start formatted region

Visitor objects can raise two exceptions in this method to influence the tree traversal:

  1. VisitorStop will cancel the current parsing, but without raising an error. So code implementing a visit method should catch this.
  2. VisitorSkip can be raised when the visitor wants to skip a node, and should prevent the implementation from further decending into this node
Parameters
tagthe tag name
attriboptional 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
def text(self, text): (source)
Append text
Parameters
texttext to be appended as string
Unknown Field: implementation
optional for subclasses
headings: list = (source)

Undocumented

max_level = (source)

Undocumented

def _close(self): (source)

Undocumented

def _split(self): (source)

Undocumented

_builder = (source)

Undocumented