minor fix

pull/142/head
Aevann 2023-03-26 14:27:40 +02:00
parent 23e4c76d24
commit 5c32c8215e
1 changed files with 6 additions and 5 deletions

View File

@ -637,11 +637,12 @@ def complies_with_chud(obj):
old_body_html = obj.body_html old_body_html = obj.body_html
#torture body_html #torture body_html
soup = BeautifulSoup(obj.body_html, 'lxml') if obj.body_html:
tags = soup.html.body.find_all(lambda tag: tag.name not in {'blockquote','codeblock','pre'} and tag.string, recursive=False) soup = BeautifulSoup(obj.body_html, 'lxml')
for tag in tags: tags = soup.html.body.find_all(lambda tag: tag.name not in {'blockquote','codeblock','pre'} and tag.string, recursive=False)
tag.string.replace_with(torture_ap(tag.string, obj.author.username)) for tag in tags:
obj.body_html = str(soup).replace('<html><body>','').replace('</body></html>','') tag.string.replace_with(torture_ap(tag.string, obj.author.username))
obj.body_html = str(soup).replace('<html><body>','').replace('</body></html>','')
#torture title_html and check for agendaposter_phrase in plain title and leave if it's there #torture title_html and check for agendaposter_phrase in plain title and leave if it's there
if isinstance(obj, Submission): if isinstance(obj, Submission):