remove duplicate xescape(s)
This commit is contained in:
parent
fd857985f6
commit
ac72d623f0
1 changed files with 0 additions and 19 deletions
|
@ -543,25 +543,6 @@ class UiRequest(object):
|
||||||
|
|
||||||
if show_loadingscreen:
|
if show_loadingscreen:
|
||||||
meta_tags += '<meta name="viewport" id="viewport" content="width=device-width, initial-scale=0.8">';
|
meta_tags += '<meta name="viewport" id="viewport" content="width=device-width, initial-scale=0.8">';
|
||||||
|
|
||||||
def xescape(s):
|
|
||||||
'''combines parts from re.escape & html.escape'''
|
|
||||||
# https://github.com/python/cpython/blob/3.10/Lib/re.py#L267
|
|
||||||
# '&' is handled otherwise
|
|
||||||
re_chars = {i: '\\' + chr(i) for i in b'()[]{}*+-|^$\\.~# \t\n\r\v\f'}
|
|
||||||
# https://github.com/python/cpython/blob/3.10/Lib/html/__init__.py#L12
|
|
||||||
html_chars = {
|
|
||||||
'<' : '<',
|
|
||||||
'>' : '>',
|
|
||||||
'"' : '"',
|
|
||||||
"'" : ''',
|
|
||||||
}
|
|
||||||
# we can't replace '&' because it makes certain zites work incorrectly
|
|
||||||
# it should however in no way interfere with re.sub in render
|
|
||||||
repl = {}
|
|
||||||
repl.update(re_chars)
|
|
||||||
repl.update(html_chars)
|
|
||||||
return s.translate(repl)
|
|
||||||
|
|
||||||
def xescape(s):
|
def xescape(s):
|
||||||
'''combines parts from re.escape & html.escape'''
|
'''combines parts from re.escape & html.escape'''
|
||||||
|
|
Loading…
Reference in a new issue