class documentation

class Dumper(DumperClass): (source)

View In Hierarchy

Undocumented

Method dump Format a parsetree to text @param tree: a parse tree object that supports a visit() method @returns: a list of lines
Method dump_anchor Undocumented
Method dump_block Undocumented
Method dump_h Undocumented
Method dump_img Undocumented
Method dump_li Undocumented
Method dump_line Undocumented
Method dump_link Undocumented
Method dump_object Dumps objects defined by InsertedObjectType
Method dump_object_fallback Method to serialize objects that do not have their own handler for this format. @implementation: must be implemented in sub-classes
Method dump_ol Undocumented
Method dump_table Undocumented
Method dump_td Undocumented
Method dump_th Undocumented
Method dump_thead Undocumented
Method dump_trow Undocumented
Method encode_text Optional method to encode text elements in the output
Method text Append text @param text: text to be appended as string @implementation: optional for subclasses
Constant TAGS Undocumented
Constant TEMPLATE_OPTIONS Undocumented
Method _strip_newline Undocumented
Instance Variable _isrtl Undocumented

Inherited from DumperClass:

Method __init__ Undocumented
Method append Convenience function to open a tag, append text and close it immediatly.
Method end No summary
Method get_lines Return the dumped content as a list of lines Should only be called after closing the top level element
Method isrtl No summary
Method prefix_lines No summary
Method start Start formatted region
Instance Variable context the stack of open tags maintained by this class. Can be used in dump_ methods to inspect the parent scope of the format. Elements on this stack have "tag", "attrib" and "text" attributes. Keep in mind that the parent scope is not yet complete when a tag is serialized.
Instance Variable linker the (optional) Linker object, used to resolve links
Instance Variable template_options a ConfigDict with options that may be set in a template (so inherently not safe !) to control the output style. Formats using this need to define the supported keys in the dict TEMPLATE_OPTIONS.
Instance Variable _text Undocumented
def dump(self, tree): (source)
Format a parsetree to text
Parameters
treea parse tree object that supports a visit() method
Returns
a list of lines
def dump_anchor(self, tag, attrib, strings=None): (source)

Undocumented

def dump_block(self, tag, attrib, strings, _extra=None): (source)

Undocumented

def dump_h(self, tag, attrib, strings): (source)

Undocumented

def dump_img(self, tag, attrib, strings=None): (source)

Undocumented

def dump_li(self, tag, attrib, strings): (source)

Undocumented

def dump_line(self, tag, attrib, strings=None): (source)

Undocumented

def dump_link(self, tag, attrib, strings=None): (source)

Undocumented

def dump_object(self, tag, attrib, strings=[]): (source)
Dumps objects defined by InsertedObjectType
def dump_object_fallback(self, tag, attrib, strings=None): (source)
Method to serialize objects that do not have their own handler for this format.
Unknown Field: implementation
must be implemented in sub-classes
def dump_ol(self, tag, attrib, strings): (source)

Undocumented

def dump_table(self, tag, attrib, strings): (source)

Undocumented

def dump_td(self, tag, attrib, strings): (source)

Undocumented

def dump_th(self, tag, attrib, strings): (source)

Undocumented

def dump_thead(self, tag, attrib, strings): (source)

Undocumented

def dump_trow(self, tag, attrib, strings): (source)

Undocumented

def encode_text(self, tag, text): (source)
Optional method to encode text elements in the output
Parameters
tagformatting tag
texttext to be encoded
Returns
encoded text
Note
Do not apply text encoding in the dump_ methods, the list of strings given there may contain prefix and postfix formatting of nested tags.
Unknown Field: implementation
optional, default just returns unmodified input
def text(self, text): (source)
Append text
Parameters
texttext to be appended as string
Unknown Field: implementation
optional for subclasses
TAGS = (source)

Undocumented

Value
{EMPHASIS: ('<i>', '</i>'),
 STRONG: ('<b>', '</b>'),
 MARK: ('<u>', '</u>'),
 STRIKE: ('<s>', '</s>'),
 VERBATIM: ('<tt>', '</tt>'),
 TAG: ('<span class="zim-tag">', '</span>'),
 SUBSCRIPT: ('<sub>', '</sub>'),
...
TEMPLATE_OPTIONS = (source)

Undocumented

Value
{'empty_lines': Choice('default', ('default', 'remove')),
 'line_breaks': Choice('default', ('default', 'remove'))}
def _strip_newline(self, strings): (source)

Undocumented

_isrtl = (source)

Undocumented