diff options
| author | 2019-10-15 16:44:28 +0100 | |
|---|---|---|
| committer | 2019-10-15 16:44:28 +0100 | |
| commit | fa97f12689d3ef3e3da81ebdb8b199fbbf40e29a (patch) | |
| tree | 9b4b0775d2ba9e1238cbf49962e88cd624eba1de | |
| parent | mapped event names for gitlab webhooks should be 'issue' not 'issues' (diff) | |
| signature | ||
support AP Notes with content outside of HTML tags (e.g. pleroma)
| -rw-r--r-- | modules/fediverse/ap_utils.py | 21 |
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) |
