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: ...@@ -56,7 +56,7 @@ class HTMLClass:
def document(self, doc, level, output): def document(self, doc, level, output):
children=doc.getChildNodes() children=doc.getChildNodes()
if self.header==1: if self.header:
output('<html>\n') output('<html>\n')
if (children and if (children and
children[0].getNodeName() == 'StructuredTextSection'): children[0].getNodeName() == 'StructuredTextSection'):
...@@ -67,7 +67,7 @@ class HTMLClass: ...@@ -67,7 +67,7 @@ class HTMLClass:
for c in children: for c in children:
getattr(self, self.element_types[c.getNodeName()])(c, level, output) getattr(self, self.element_types[c.getNodeName()])(c, level, output)
if self.header==1: if self.header:
output('</body>\n') output('</body>\n')
output('</html>\n') output('</html>\n')
......
...@@ -22,6 +22,8 @@ class HTMLWithImages(HTMLClass): ...@@ -22,6 +22,8 @@ class HTMLWithImages(HTMLClass):
element_types = ets element_types = ets
def document(self, doc, level, output): def document(self, doc, level, output):
if self.header:
output('<html>\n') output('<html>\n')
children=doc.getChildNodes() children=doc.getChildNodes()
if (children and if (children and
...@@ -29,8 +31,11 @@ class HTMLWithImages(HTMLClass): ...@@ -29,8 +31,11 @@ class HTMLWithImages(HTMLClass):
output('<head>\n<title>%s</title>\n</head>\n' % output('<head>\n<title>%s</title>\n</head>\n' %
children[0].getChildNodes()[0].getNodeValue()) children[0].getChildNodes()[0].getNodeValue())
output('<body>\n') output('<body>\n')
for c in children: for c in children:
getattr(self, self.element_types[c.getNodeName()])(c, level, output) getattr(self, self.element_types[c.getNodeName()])(c, level, output)
if self.header:
output('</body>\n') output('</body>\n')
output('</html>\n') output('</html>\n')
......
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