mirror of
https://github.com/VikParuchuri/surya.git
synced 2026-06-04 21:03:53 +08:00
Fix edge case for empty tags
This commit is contained in:
parent
04d2ba9d9b
commit
1dd9b95a25
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user