fixed strikethrough

master
Aevann1 2022-06-28 07:41:21 +02:00
parent 61d0c34b05
commit 50121f6960
2 changed files with 2 additions and 4 deletions

View File

@ -40,7 +40,7 @@ spoiler_regex = re.compile('''\|\|(.+)\|\|''', flags=re.A)
reddit_regex = re.compile('(^|\s|<p>)\/?((r|u)\/(\w|-){3,25})(?![^<]*<\/(code|pre|a)>)', flags=re.A)
sub_regex = re.compile('(^|\s|<p>)\/?(h\/(\w|-){3,25})(?![^<]*<\/(code|pre|a)>)', flags=re.A)
strikethrough_regex = re.compile('''~{1,2}([^~]+)~{1,2}''', flags=re.A)
strikethrough_regex = re.compile('(^|\s)~{1,2}([^~]+)~{1,2}', flags=re.A)
mute_regex = re.compile("/mute @([a-z0-9_\-]{3,25}) ([0-9])+", flags=re.A)

View File

@ -186,8 +186,6 @@ def sanitize(sanitized, edit=False):
sanitized = markdown(sanitized)
sanitized = strikethrough_regex.sub(r'<del>\1</del>', sanitized)
sanitized = sanitized.replace('','').replace('','').replace("\ufeff", "").replace("𒐪","")
sanitized = reddit_regex.sub(r'\1<a href="https://old.reddit.com/\2" rel="nofollow noopener noreferrer">/\2</a>', sanitized)
@ -377,7 +375,7 @@ def filter_emojis_only(title, edit=False, graceful=False):
marsey.count += 1
g.db.add(marsey)
title = strikethrough_regex.sub(r'<del>\1</del>', title)
title = strikethrough_regex.sub(r'\1<del>\2</del>', title)
title = bleach.clean(title, tags=['img','del','span'], attributes=allowed_attributes_emojis, protocols=['http','https'])