forked from indymedia/epicyon
Sequence of emoji codes
parent
4173ea679e
commit
29783f7bf4
20
content.py
20
content.py
|
@ -64,14 +64,32 @@ def replaceEmojiFromTags(content: str,tag: [],messageType: str) -> str:
|
||||||
if iconName:
|
if iconName:
|
||||||
if len(iconName)>1:
|
if len(iconName)>1:
|
||||||
if iconName[0].isdigit():
|
if iconName[0].isdigit():
|
||||||
if '.' in iconName and '-' not in iconName:
|
if '.' in iconName:
|
||||||
iconName=iconName.split('.')[0]
|
iconName=iconName.split('.')[0]
|
||||||
|
# see https://unicode.org/emoji/charts/full-emoji-list.html
|
||||||
|
if '-' not in iconName:
|
||||||
|
# a single code
|
||||||
try:
|
try:
|
||||||
content= \
|
content= \
|
||||||
content.replace(tagItem['name'], \
|
content.replace(tagItem['name'], \
|
||||||
chr(int("0x"+iconName,16)))
|
chr(int("0x"+iconName,16)))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
# sequence of codes
|
||||||
|
iconCodes=iconName.split('-')
|
||||||
|
iconCodeSequence=''
|
||||||
|
for icode in iconCodes:
|
||||||
|
try:
|
||||||
|
iconCodeSequence+=chr(int("0x"+iconName,16))
|
||||||
|
except:
|
||||||
|
iconCodeSequence=''
|
||||||
|
break
|
||||||
|
if iconCodeSequence:
|
||||||
|
content= \
|
||||||
|
content.replace(tagItem['name'], \
|
||||||
|
iconCodeSequence)
|
||||||
|
|
||||||
htmlClass='emoji'
|
htmlClass='emoji'
|
||||||
if messageType=='post header':
|
if messageType=='post header':
|
||||||
htmlClass='emojiheader'
|
htmlClass='emojiheader'
|
||||||
|
|
Loading…
Reference in New Issue