summaryrefslogtreecommitdiffstats
path: root/htmlbuffer.py
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2002-12-27 18:37:34 +0000
committerMatt Wilson <msw@redhat.com>2002-12-27 18:37:34 +0000
commit3d978cf0bfb08fb35cdbd14448e850b892a84075 (patch)
treead8fb25ebc4619979ba5a6128d2531e869fdb18c /htmlbuffer.py
parent2da83fcc89acf9d1440615a6d2b3a9c41e839903 (diff)
downloadanaconda-3d978cf0bfb08fb35cdbd14448e850b892a84075.tar.gz
anaconda-3d978cf0bfb08fb35cdbd14448e850b892a84075.tar.xz
anaconda-3d978cf0bfb08fb35cdbd14448e850b892a84075.zip
fix <, >, and " entities (#80277)
Diffstat (limited to 'htmlbuffer.py')
-rw-r--r--htmlbuffer.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/htmlbuffer.py b/htmlbuffer.py
index 007c93258..ae535543f 100644
--- a/htmlbuffer.py
+++ b/htmlbuffer.py
@@ -25,6 +25,10 @@ class HTMLBuffer(HTMLParser.HTMLParser):
ignoreTags = ('title',)
noTagTags = ('html', 'head', 'span')
newlineTags = ('p', 'h1', 'h2')
+ entityRefMap = { 'copy': unichr(0xA9),
+ 'lt': '<',
+ 'gt': '>',
+ 'quot': '"'}
whiteSpaceNuker = re.compile(r"""\s+""", re.MULTILINE)
def __init__(self):
self.buffer = gtk.TextBuffer(None)
@@ -172,9 +176,11 @@ class HTMLBuffer(HTMLParser.HTMLParser):
def handle_entityref(self, name):
if self.ignoreData != 0:
return
- if name == 'copy':
- # (c) is unicode 00A9
- self.buffer.insert(self.iter, unichr(0xA9))
+ if self.entityRefMap.has_key(name):
+ self.buffer.insert(self.iter, self.entityRefMap[name])
+ else:
+ pass
+ #print "warning: unhandled entity", name
if __name__ == '__main__':
def quit(*args):