master
Aevann1 2021-10-01 02:23:26 +02:00
parent 0864eed0a6
commit 92dc243b14
1 changed files with 3 additions and 5 deletions

View File

@ -214,8 +214,8 @@ def sanitize(sanitized, noimages=False):
if start in sanitized and end in sanitized and start in sanitized.split(end)[0] and end in sanitized.split(start)[1]: sanitized = sanitized.replace(start, '<span class="spoiler">').replace(end, '</span>')
for i in re.finditer("<p>\s*((:\w+:)\s*)+<\/p>", sanitized):
emojis = i.group(0).lower()
print(emojis)
old = i.group(0)
emojis = i.group(0).lower().replace("<p>", "<p style='margin-bottom:0 !important'>")
for i in re.finditer('\w*(?<!"):([^ ]{1,30}?):', emojis):
emoji = i.group(1).lower()
if path.isfile(f'./files/assets/images/emojis/{emoji}.webp'):
@ -224,9 +224,7 @@ def sanitize(sanitized, noimages=False):
if emoji in session["favorite_emojis"]: session["favorite_emojis"][emoji] += 1
else: session["favorite_emojis"][emoji] = 1
old = "<p>" + i.group(0) + "</p>"
new = "<p style='margin-bottom:0 !important'>" + emojis + "</p>"
sanitized = sanitized.replace(old, new)
sanitized = sanitized.replace(old, emojis)
# for i in re.finditer('\w*(?<!"):([^ ]{1,30}?):', sanitized):
# emoji = i.group(1).lower()