Python: add > escaping

This commit is contained in:
Ian Gulliver
2014-07-02 13:42:17 -07:00
parent 2e75804e30
commit 8a9f9acbaa
2 changed files with 6 additions and 3 deletions

View File

@@ -20,7 +20,10 @@ class TextNode(object):
return self.textContent
def __str__(self):
return self.textContent.replace('&', '&amp;').replace('<', '&lt;')
return (self.textContent
.replace('&', '&amp;')
.replace('<', '&lt;')
.replace('>', '&gt;'))
class Element(object):