Emoji tag icon

master
Bob Mottram 2019-08-19 14:35:55 +01:00
parent bc7f1ef8dd
commit 64a4048002
2 changed files with 12 additions and 8 deletions

View File

@ -89,12 +89,14 @@ def addEmoji(baseDir: str,wordStr: str,httpPrefix: str,domain: str,replaceEmoji:
return False return False
emojiUrl=httpPrefix+"://"+domain+"/emoji/"+emojiDict[emoji]+'.png' emojiUrl=httpPrefix+"://"+domain+"/emoji/"+emojiDict[emoji]+'.png'
postTags[emoji]= { postTags[emoji]= {
'id': emojiUrl, 'icon': {
'mediaType': 'image/png',
'type': 'Image',
'url': emojiUrl
},
'name': ':'+emoji+':', 'name': ':'+emoji+':',
'type': 'Emoji' 'type': 'Emoji'
} }
#replaceEmoji[wordStr]= \
# "<img src=\""+emojiUrl+"\" alt=\""+emoji+"\" align=\"middle\" class=\"emoji\"/>"
return True return True
def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},recipients: [],tags: {}) -> bool: def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},recipients: [],tags: {}) -> bool:

View File

@ -944,17 +944,19 @@ def htmlRemplaceEmojiFromTags(content: str,tag: {}) -> str:
"""Uses the tags to replace :emoji: with html image markup """Uses the tags to replace :emoji: with html image markup
""" """
for tagItem in tag: for tagItem in tag:
if not tagItem.get('id'):
continue
if not tagItem.get('type'): if not tagItem.get('type'):
continue continue
if not tagItem.get('name'):
continue
if tagItem['type']!='Emoji': if tagItem['type']!='Emoji':
continue continue
if not tagItem.get('name'):
continue
if not tagItem.get('icon'):
continue
if not tagItem['icon'].get('url'):
continue
if tagItem['name'] not in content: if tagItem['name'] not in content:
continue continue
emojiHtml="<img src=\""+tagItem['id']+"\" alt=\""+tagItem['name'].replace(':','')+"\" align=\"middle\" class=\"emoji\"/>" emojiHtml="<img src=\""+tagItem['icon']['url']+"\" alt=\""+tagItem['name'].replace(':','')+"\" align=\"middle\" class=\"emoji\"/>"
content=content.replace(tagItem['name'],emojiHtml) content=content.replace(tagItem['name'],emojiHtml)
return content return content