fixing decodeHtml
This commit is contained in:
parent
dc56e05b3f
commit
0a4acbc2f9
1 changed files with 4 additions and 4 deletions
|
@ -138,9 +138,9 @@ def decodeHtml(html):
|
||||||
>>> decodeHtml('me & you and $&%')
|
>>> decodeHtml('me & you and $&%')
|
||||||
u'me & you and $&%'
|
u'me & you and $&%'
|
||||||
"""
|
"""
|
||||||
if type(text) != unicode:
|
if type(html) != unicode:
|
||||||
text = unicode(text)[:]
|
html = unicode(html)[:]
|
||||||
if type(text) is unicode:
|
if type(html) is unicode:
|
||||||
uchr = unichr
|
uchr = unichr
|
||||||
else:
|
else:
|
||||||
uchr = lambda value: value > 255 and unichr(value) or chr(value)
|
uchr = lambda value: value > 255 and unichr(value) or chr(value)
|
||||||
|
@ -154,7 +154,7 @@ def decodeHtml(html):
|
||||||
return uchr(name2codepoint[entity])
|
return uchr(name2codepoint[entity])
|
||||||
else:
|
else:
|
||||||
return match.group(0)
|
return match.group(0)
|
||||||
return charrefpat.sub(entitydecode, text).replace(u'\xa0', ' ')
|
return charrefpat.sub(entitydecode, html).replace(u'\xa0', ' ')
|
||||||
|
|
||||||
def highlight(text, query, hlClass="hl"):
|
def highlight(text, query, hlClass="hl"):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue