move if condition

pull/142/head
Aevann 2023-03-25 21:04:20 +02:00
parent 1335b48ac6
commit 5c3ba375ba
1 changed files with 2 additions and 3 deletions

View File

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