pango: don't expand '&' when it is part of an HTML escape sequence
This commit is contained in:
parent
bfbdc60b31
commit
39d8d2778d
@ -1,3 +1,4 @@
|
||||
import html
|
||||
import inspect
|
||||
import traceback
|
||||
|
||||
@ -260,14 +261,16 @@ class Module(SettingsBase):
|
||||
|
||||
Can be called multiple times (`&` won't change to `&`).
|
||||
"""
|
||||
def replace(s):
|
||||
s = s.split("&")
|
||||
out = s[0]
|
||||
for i in range(len(s) - 1):
|
||||
if s[i + 1].startswith("amp;"):
|
||||
out += "&" + s[i + 1]
|
||||
def replace(text):
|
||||
components = text.split("&")
|
||||
out = components[0]
|
||||
for item in components[1:]:
|
||||
if item.startswith("amp;") \
|
||||
or (not item.startswith("amp;")
|
||||
and html.unescape(f'&{item}') != f'&{item}'):
|
||||
out += "&" + item
|
||||
else:
|
||||
out += "&" + s[i + 1]
|
||||
out += "&" + item
|
||||
return out
|
||||
|
||||
if "full_text" in self.output.keys():
|
||||
|
Loading…
Reference in New Issue
Block a user