Update sanitize_html.py

This commit is contained in:
Kylie 2021-07-31 19:54:59 -04:00 committed by GitHub
parent d75f33cfb2
commit 1c7ed30d65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,8 +26,6 @@ class InputHtmlParser(HTMLParser): # pylint: disable=abstract-method
self.output = [] self.output = []
# if the html appears invalid, we just won't allow any at all # if the html appears invalid, we just won't allow any at all
self.allow_html = True self.allow_html = True
self.output.append(("data", "<style>.show-white-space{white-space:pre-wrap;}</style>"))
self.output.append(("data", "<span class=\"show-white-space\">"))
def handle_starttag(self, tag, attrs): def handle_starttag(self, tag, attrs):
"""check if the tag is valid""" """check if the tag is valid"""
@ -58,7 +56,6 @@ class InputHtmlParser(HTMLParser): # pylint: disable=abstract-method
def get_output(self): def get_output(self):
"""convert the output from a list of tuples to a string""" """convert the output from a list of tuples to a string"""
self.output.append(("data", "</span>"))
if self.tag_stack: if self.tag_stack:
self.allow_html = False self.allow_html = False
if not self.allow_html: if not self.allow_html: