Commit df18fde8 authored by Andreas Jung's avatar Andreas Jung

- <li> no longer uses <p> tags to enclose text

- minor code cleanup (striping of unused spaces)
parent 9e60fb80
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
# #
############################################################################## ##############################################################################
from string import join, split, find
from cgi import escape from cgi import escape
import re, sys, ST import re, sys, ST
...@@ -49,10 +48,10 @@ class HTMLClass: ...@@ -49,10 +48,10 @@ class HTMLClass:
r=[] r=[]
self.header = header self.header = header
self.dispatch(doc, level-1, r.append) self.dispatch(doc, level-1, r.append)
return join(r,'') return ''.join(r)
def _text(self, doc, level, output): def _text(self, doc, level, output):
output((doc.getNodeValue())) output(doc.getNodeValue().strip())
def document(self, doc, level, output): def document(self, doc, level, output):
children=doc.getChildNodes() children=doc.getChildNodes()
...@@ -109,11 +108,11 @@ class HTMLClass: ...@@ -109,11 +108,11 @@ class HTMLClass:
p=doc.getPreviousSibling() p=doc.getPreviousSibling()
if p is None or p.getNodeName() is not doc.getNodeName(): if p is None or p.getNodeName() is not doc.getNodeName():
output('\n<ul>\n') output('\n<ul>\n')
output('<li><p>') output('<li>')
for c in doc.getChildNodes(): for c in doc.getChildNodes():
getattr(self, self.element_types[c.getNodeName()])(c, level, output) getattr(self, self.element_types[c.getNodeName()])(c, level, output)
n=doc.getNextSibling() n=doc.getNextSibling()
output('</p></li>\n') output('</li>\n')
if n is None or n.getNodeName() is not doc.getNodeName(): if n is None or n.getNodeName() is not doc.getNodeName():
output('\n</ul>\n') output('\n</ul>\n')
...@@ -121,11 +120,11 @@ class HTMLClass: ...@@ -121,11 +120,11 @@ class HTMLClass:
p=doc.getPreviousSibling() p=doc.getPreviousSibling()
if p is None or p.getNodeName() is not doc.getNodeName(): if p is None or p.getNodeName() is not doc.getNodeName():
output('\n<ol>\n') output('\n<ol>\n')
output('<li><p>') output('<li>')
for c in doc.getChildNodes(): for c in doc.getChildNodes():
getattr(self, self.element_types[c.getNodeName()])(c, level, output) getattr(self, self.element_types[c.getNodeName()])(c, level, output)
n=doc.getNextSibling() n=doc.getNextSibling()
output('</p></li>\n') output('</li>\n')
if n is None or n.getNodeName() is not doc.getNodeName(): if n is None or n.getNodeName() is not doc.getNodeName():
output('\n</ol>\n') output('\n</ol>\n')
...@@ -235,8 +234,3 @@ class HTMLClass: ...@@ -235,8 +234,3 @@ class HTMLClass:
output("</td>\n") output("</td>\n")
output("</tr>\n") output("</tr>\n")
output("</table>\n") output("</table>\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