Commit 6b3c9211 authored by Andreas Jung's avatar Andreas Jung

document() function of HTMLWithImages now behaves like in HTMLClass

and recognizes the header attribute
parent f6a8b104
......@@ -56,7 +56,7 @@ class HTMLClass:
def document(self, doc, level, output):
children=doc.getChildNodes()
if self.header==1:
if self.header:
output('<html>\n')
if (children and
children[0].getNodeName() == 'StructuredTextSection'):
......@@ -67,7 +67,7 @@ class HTMLClass:
for c in children:
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
if self.header==1:
if self.header:
output('</body>\n')
output('</html>\n')
......
......@@ -22,17 +22,22 @@ class HTMLWithImages(HTMLClass):
element_types = ets
def document(self, doc, level, output):
output('<html>\n')
children=doc.getChildNodes()
if (children and
children[0].getNodeName() == 'StructuredTextSection'):
output('<head>\n<title>%s</title>\n</head>\n' %
children[0].getChildNodes()[0].getNodeValue())
output('<body>\n')
if self.header:
output('<html>\n')
children=doc.getChildNodes()
if (children and
children[0].getNodeName() == 'StructuredTextSection'):
output('<head>\n<title>%s</title>\n</head>\n' %
children[0].getChildNodes()[0].getNodeValue())
output('<body>\n')
for c in children:
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
output('</body>\n')
output('</html>\n')
if self.header:
output('</body>\n')
output('</html>\n')
def image(self, doc, level, output):
if hasattr(doc, 'key'):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment