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:
parent
fa36e48075
commit
77f614be86
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user