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 inspect
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
@ -260,14 +261,16 @@ class Module(SettingsBase):
|
|||||||
|
|
||||||
Can be called multiple times (`&` won't change to `&`).
|
Can be called multiple times (`&` won't change to `&`).
|
||||||
"""
|
"""
|
||||||
def replace(s):
|
def replace(text):
|
||||||
s = s.split("&")
|
components = text.split("&")
|
||||||
out = s[0]
|
out = components[0]
|
||||||
for i in range(len(s) - 1):
|
for item in components[1:]:
|
||||||
if s[i + 1].startswith("amp;"):
|
if item.startswith("amp;") \
|
||||||
out += "&" + s[i + 1]
|
or (not item.startswith("amp;")
|
||||||
|
and html.unescape(f'&{item}') != f'&{item}'):
|
||||||
|
out += "&" + item
|
||||||
else:
|
else:
|
||||||
out += "&" + s[i + 1]
|
out += "&" + item
|
||||||
return out
|
return out
|
||||||
|
|
||||||
if "full_text" in self.output.keys():
|
if "full_text" in self.output.keys():
|
||||||
|
Loading…
Reference in New Issue
Block a user