def __init__(self, ns): XmlEnvironment.__init__(self) self.res = u'' self.currentContent = u'' self.currentElements = [] # Stack of currently walked elements self.currentLists = [] # Stack of currently walked lists (ul or ol) self.currentTables = [] # Stack of currently walked tables self.textNs = ns[OdfEnvironment.NS_TEXT] self.linkNs = ns[OdfEnvironment.NS_XLINK] self.tableNs = ns[OdfEnvironment.NS_TABLE] self.ignore = False # Will be True when parsing parts of the XHTML that
def __init__(self, renderer): XmlEnvironment.__init__(self) self.renderer = renderer self.ns = renderer.currentParser.env.namespaces self.res = u'' self.currentContent = u'' self.currentElements = [] # Stack of currently walked elements self.currentLists = [] # Stack of currently walked lists (ul or ol) self.currentTables = [] # Stack of currently walked tables self.textNs = self.ns[OdfEnvironment.NS_TEXT] self.linkNs = self.ns[OdfEnvironment.NS_XLINK] self.tableNs = self.ns[OdfEnvironment.NS_TABLE] # The following attr will be True when parsing parts of the XHTML that # must be ignored. self.ignore = False
def __init__(self, ns): XmlEnvironment.__init__(self) self.res = u'' self.currentContent = u'' self.currentElements = [] # Stack of currently walked elements self.currentLists = [] # Stack of currently walked lists (ul or ol) self.currentTables = [] # Stack of currently walked tables self.creatingRootParagraph = False # Within the XHTML chunk given to this parser, there may be some # content that is not enclosed within any tag (at "root" level). When I # encounter such content, I will include it into a root paragraph with # default style. This content may include sub-tags of course (span, # div, img, a...) or may already be dumped entirely if I encounter # "paragraph-style" sub-tags (h1, h2, p...). self.creatingRootParagraph # tells me if I am still in a root paragraph. So when I encounter a # "root" content I know if I must reopen a new paragraph or not, for # example. self.textNs = ns[OdfEnvironment.NS_TEXT] self.linkNs = ns[OdfEnvironment.NS_XLINK] self.tableNs = ns[OdfEnvironment.NS_TABLE] self.ignore = False # Will be True when parsing parts of the XHTML that