From d871e6c9f89724b8a9d088999f953d67534e2e8f Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 25 Mar 2023 00:45:31 +0200 Subject: [PATCH] allow chud phrase in header tags --- files/helpers/sanitize.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index e273c2079f..e0f6b0c395 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -611,7 +611,8 @@ def validate_css(css): return True, "" - + +phrase_tags = {'p','h1','h2','h3','h4','h5','h6'} def complies_with_chud(obj): if not obj.author.agendaposter: return True if obj.author.marseyawarded: return True @@ -636,7 +637,7 @@ def complies_with_chud(obj): print(f'{STARS}{old_body_html}{STARS}', flush=True) return False - tags = soup.html.body.find_all(lambda tag: tag.name == 'p' and not tag.attrs, recursive=False) + tags = soup.html.body.find_all(lambda tag: tag.name in phrase_tags and not tag.attrs, recursive=False) for tag in tags: for text in tag.find_all(text=True, recursive=False):