make all syntax compatible with 3.1 and 2.5

--HG--
branch : trunk
This commit is contained in:
Benjamin Peterson
2009-08-29 13:04:48 -05:00
parent 6f4c6d36a4
commit ee1747fcb4
60 changed files with 230 additions and 177 deletions

View File

@@ -28,11 +28,16 @@ class HtmlVisitor(SimpleUnicodeVisitor):
def _isinline(self, tagname):
return tagname in self.inline
if sys.version_info > (3, 0):
def u(s): return s
else:
def u(s): return unicode(s)
class HtmlTag(Tag):
def unicode(self, indent=2):
l = []
HtmlVisitor(l.append, indent, shortempty=False).visit(self)
return u"".join(l)
return u("").join(l)
# exported plain html namespace
class html(Namespace):