support AP Notes with content outside of HTML tags (e.g. pleroma)
This commit is contained in:
parent
491ad531c2
commit
fa97f12689
1 changed files with 12 additions and 9 deletions
|
@ -68,8 +68,9 @@ def _normalise_note(content):
|
|||
element.decompose()
|
||||
elif not element.name in KNOWN_TAGS:
|
||||
element.unwrap()
|
||||
for element in soup.find_all():
|
||||
for element in soup.children:
|
||||
out = ""
|
||||
if type(element) == bs4.element.Tag:
|
||||
if element.name == "p":
|
||||
for subitem in element.contents:
|
||||
if type(subitem) == bs4.element.Tag:
|
||||
|
@ -78,6 +79,8 @@ def _normalise_note(content):
|
|||
out = ""
|
||||
else:
|
||||
out += subitem
|
||||
else:
|
||||
out += element
|
||||
|
||||
lines.append(out.replace(" ", " "))
|
||||
return " ".join(lines)
|
||||
|
|
Loading…
Reference in a new issue