1
0
mirror of https://github.com/Mikaela/Limnoria.git synced 2025-01-14 22:22:42 +01:00

utils.web.HtmlToText: Convert html entities.

This commit is contained in:
Valentin Lorentz 2013-02-01 20:50:46 +01:00
parent fa36e48075
commit 77f614be86

View File

@ -179,6 +179,9 @@ class HtmlToText(HTMLParser, object):
def handle_data(self, data):
self.data.append(data)
def handle_entityref(self, data):
self.data.append(chr(htmlentitydefs.name2codepoint[data]))
def getText(self):
text = ''.join(self.data).strip()
return normalizeWhitespace(text)