soup2html() tweak to handle html comments.

- Legacy-Id: 328
This commit is contained in:
Henrik Levkowetz 2007-06-12 00:37:16 +00:00
parent 9589d3f1c9
commit 67eb998901

View file

@ -51,6 +51,8 @@ def normalize(str):
# Normalize whitespace at the beginning and end of the string
str = re.sub("^[ \t\n]+", " ", str)
str = re.sub("[ \t\n]+$", " ", str)
# remove comments
str = re.sub("(?s)<!--.*?-->", "", str)
# remove xml PIs and metainformation
str = re.sub("<![^>]*>", "", str)
str = re.sub("<\?[^>]*\?>", "", str)