Skip to content

Commit 67eb998

Browse files
committed
soup2html() tweak to handle html comments.
- Legacy-Id: 328
1 parent 9589d3f commit 67eb998

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

ietf/utils/soup2text.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def normalize(str):
5151
# Normalize whitespace at the beginning and end of the string
5252
str = re.sub("^[ \t\n]+", " ", str)
5353
str = re.sub("[ \t\n]+$", " ", str)
54+
# remove comments
55+
str = re.sub("(?s)<!--.*?-->", "", str)
5456
# remove xml PIs and metainformation
5557
str = re.sub("<![^>]*>", "", str)
5658
str = re.sub("<\?[^>]*\?>", "", str)

0 commit comments

Comments
 (0)