forked from MarseyWorld/MarseyWorld
fgfggf
parent
52a14de6d3
commit
d175932599
|
@ -191,17 +191,18 @@ def sanitize(sanitized, noimages=False):
|
|||
for i in re.finditer("<p>\s*(((:\w+:)|(!\w+!))\s*)+<\/p>", sanitized):
|
||||
old = i.group(0)
|
||||
new = old.lower().replace("<p>", "<p style='margin-bottom:0'>")
|
||||
for i in re.finditer('\w*(?<!")((:([^ ]{1,30}?):)|(!([^ ]{1,30}?)!))', new):
|
||||
emoji = i.group(0).lower()
|
||||
print(emoji)
|
||||
delim = emoji[0]
|
||||
print(delim)
|
||||
emoji = emoji[1:-1]
|
||||
for i in re.finditer('\w*(?<!"):([^ ]{1,30}?):', new):
|
||||
emoji = i.group(1).lower()
|
||||
if path.isfile(f'./files/assets/images/emojis/{emoji}.webp'):
|
||||
if delim == "!":
|
||||
new = re.sub(f'\w*(?<!")!{emoji}!', f'<img loading="lazy" data-bs-toggle="tooltip" alt="!{emoji}!" title="!{emoji}!" delay="0" height=60 src="https://{site}/assets/images/emojis/{emoji}.webp" style="transform: scaleX(-1)">', new)
|
||||
else:
|
||||
new = re.sub(f'\w*(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" height=60 src="https://{site}/assets/images/emojis/{emoji}.webp">', new)
|
||||
new = re.sub(f'\w*(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" height=60 src="https://{site}/assets/images/emojis/{emoji}.webp">', new)
|
||||
|
||||
if emoji in session["favorite_emojis"]: session["favorite_emojis"][emoji] += 1
|
||||
else: session["favorite_emojis"][emoji] = 1
|
||||
|
||||
for i in re.finditer('\w*(?<!")!([^ ]{1,30}?)!', new):
|
||||
emoji = i.group(1).lower()
|
||||
if path.isfile(f'./files/assets/images/emojis/{emoji}.webp'):
|
||||
new = re.sub(f'\w*(?<!")!{emoji}!', f'<img loading="lazy" data-bs-toggle="tooltip" alt="!{emoji}!" title="!{emoji}!" delay="0" height=60 src="https://{site}/assets/images/emojis/{emoji}.webp" style="transform: scaleX(-1)">', new)
|
||||
|
||||
if emoji in session["favorite_emojis"]: session["favorite_emojis"][emoji] += 1
|
||||
else: session["favorite_emojis"][emoji] = 1
|
||||
|
|
Loading…
Reference in New Issue