remove unescape()

This commit is contained in:
2026-09-08 15:37:40 +02:00
parent ce7e0c6624
commit 218c27c726
+4 -4
View File
@@ -134,7 +134,8 @@ def clean_html(input_file, output_file):
#20260104: removed "span", </span> #20260104: removed "span", </span>
#20260122: move the function check_input_name into the function clean_html as inner function #20260122: move the function check_input_name into the function clean_html as inner function
#20260128: removed text-align:justify in <p> #20260128: removed text-align:justify in <p>
#version: 3_5_3_3 #20260129: added strikethrough tag: <s>, <del>, <ins>: insert with underline
#version: 3_5_3_5
def check_input_name(attribute): def check_input_name(attribute):
ret_flag=False ret_flag=False
@@ -157,7 +158,6 @@ def clean_html(input_file, output_file):
nb_lines = 0 nb_lines = 0
for line_in in fi: for line_in in fi:
line_in = html.unescape(line_in)
line_out = "" line_out = ""
if not body: if not body:
@@ -235,7 +235,7 @@ def clean_html(input_file, output_file):
elif tag[0] in ["b", "/b", "em", "/em", "i", "/i", "li", "/li", "ol", "/ol", elif tag[0] in ["b", "/b", "em", "/em", "i", "/i", "li", "/li", "ol", "/ol",
"ul", "/ul", "strong", "/strong", "sub", "/sub", "sup", "/sup", "ul", "/ul", "strong", "/strong", "sub", "/sub", "sup", "/sup",
"u", "/u"]: "u", "/u", "s", "/s", "del", "/del", "ins", "/ins"]:
line_out += "<{}>".format(tag[0]) line_out += "<{}>".format(tag[0])
elif tag[0] in ["/h1", "/h2", "/h3", "/h4", "/h5", "/h6", "/p", elif tag[0] in ["/h1", "/h2", "/h3", "/h4", "/h5", "/h6", "/p",
"body", "/body", "/html", "/div", "/img", "/a"]: "body", "/body", "/html", "/div", "/img", "/a"]:
@@ -244,7 +244,7 @@ def clean_html(input_file, output_file):
line_out += "<{}>".format(tag[0]) line_out += "<{}>".format(tag[0])
elif tag[0] in ["br", "br/", "hr"]: elif tag[0] in ["br", "br/", "hr"]:
line_out += "<{}>".format(tag[0]) line_out += "<{}>".format(tag[0])
if line_out != "": if line_out != "":
fo.write(line_out + "\n") fo.write(line_out + "\n")