Fix edge case for empty tags

This commit is contained in:
Tarun Menta 2025-08-04 12:42:32 -04:00
parent 04d2ba9d9b
commit 1dd9b95a25
No known key found for this signature in database

View File

@ -47,8 +47,16 @@ def filter_blacklist_tags(text_chars: List[TextChar]) -> List[TextChar]:
if char == ">":
full_tag = ''.join(c.text for c in char_buffer)
inner = full_tag[1:-1].strip() # remove < >
tag_name_candidate = inner.strip("/").split()[0] # remove '/' and any attributes
inner = inner.strip("/") # remove '/'
# Possible that it is just an empty <>
if not inner:
filtered_chars.extend(char_buffer)
in_tag = False
char_buffer = []
continue
tag_name_candidate = inner.split()[0] # remove any attributes
if tag_name_candidate in BLACKLIST_TAGS:
# Discard tag
pass