Commit b5608dee authored by Nicolas Delaby's avatar Nicolas Delaby

Clean up comments during parsing

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33468 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fe75ed06
......@@ -286,10 +286,12 @@ class SafeHTML:
# in lxml API. I pass the argument to improve readability
# of above code.
try:
lparser = LHTMLParser(encoding=encoding, recover=True)
lparser = LHTMLParser(encoding=encoding, recover=True,
remove_comments=True)
except LookupError:
# Provided encoding is not known by parser, so discard it
lparser = LHTMLParser(recover=True)
lparser = LHTMLParser(recover=True,
remove_comments=True)
repaired_html_tree = etree.HTML(orig, parser=lparser)
html_string = etree.tostring(repaired_html_tree)
# avoid breaking now.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment