aboutsummaryrefslogtreecommitdiff
path: root/modules/fediverse/ap_utils.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-10-15 16:44:28 +0100
committerGravatar jesopo2019-10-15 16:44:28 +0100
commitfa97f12689d3ef3e3da81ebdb8b199fbbf40e29a (patch)
tree9b4b0775d2ba9e1238cbf49962e88cd624eba1de /modules/fediverse/ap_utils.py
parentmapped event names for gitlab webhooks should be 'issue' not 'issues' (diff)
signature
support AP Notes with content outside of HTML tags (e.g. pleroma)
Diffstat (limited to 'modules/fediverse/ap_utils.py')
-rw-r--r--modules/fediverse/ap_utils.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/modules/fediverse/ap_utils.py b/modules/fediverse/ap_utils.py
index e8f25bbc..412d84c1 100644
--- a/modules/fediverse/ap_utils.py
+++ b/modules/fediverse/ap_utils.py
@@ -68,16 +68,19 @@ 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 element.name == "p":
- for subitem in element.contents:
- if type(subitem) == bs4.element.Tag:
- if subitem.name == "br":
- lines.append(out)
- out = ""
- else:
- out += subitem
+ if type(element) == bs4.element.Tag:
+ if element.name == "p":
+ for subitem in element.contents:
+ if type(subitem) == bs4.element.Tag:
+ if subitem.name == "br":
+ lines.append(out)
+ out = ""
+ else:
+ out += subitem
+ else:
+ out += element
lines.append(out.replace(" ", " "))
return " ".join(lines)