From 516884acb848e692d2442a4ce083c5ff83b5296d Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 4 Nov 2019 12:51:24 +0000 Subject: [PATCH] only .decompose() when it's an empty and unknown tag --- modules/fediverse/ap_utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/fediverse/ap_utils.py b/modules/fediverse/ap_utils.py index 5993e2b2..d21985df 100644 --- a/modules/fediverse/ap_utils.py +++ b/modules/fediverse/ap_utils.py @@ -77,9 +77,10 @@ def _normalise_note(content): lines = [] for element in soup.find_all(): if not element.name in KNOWN_TAGS: - element.unwrap() - elif element.text.strip() == "": - element.decompose() + if element.text.strip() == "": + element.decompose() + else: + element.unwrap() out = "" for element in soup.children: