only .decompose() when it's an empty and unknown tag
This commit is contained in:
parent
62781badc4
commit
516884acb8
1 changed files with 4 additions and 3 deletions
|
@ -77,9 +77,10 @@ def _normalise_note(content):
|
||||||
lines = []
|
lines = []
|
||||||
for element in soup.find_all():
|
for element in soup.find_all():
|
||||||
if not element.name in KNOWN_TAGS:
|
if not element.name in KNOWN_TAGS:
|
||||||
element.unwrap()
|
if element.text.strip() == "":
|
||||||
elif element.text.strip() == "":
|
element.decompose()
|
||||||
element.decompose()
|
else:
|
||||||
|
element.unwrap()
|
||||||
|
|
||||||
out = ""
|
out = ""
|
||||||
for element in soup.children:
|
for element in soup.children:
|
||||||
|
|
Loading…
Reference in a new issue