Handle tag dictionary

main2
Bob Mottram 2019-09-29 17:48:07 +01:00
parent add425a245
commit 4f39a0c7df
2 changed files with 7 additions and 4 deletions

View File

@ -11,10 +11,14 @@ import time
import commentjson import commentjson
from shutil import copyfile from shutil import copyfile
def replaceEmojiFromTags(content: str,tag: [],messageType: str) -> str: def replaceEmojiFromTags(content: str,tag,messageType: str) -> 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: tagList=tag
if isinstance(tag, dict):
tagList=tag.items()
for tagItem in tagList:
if not tagItem.get('type'): if not tagItem.get('type'):
continue continue
if tagItem['type']!='Emoji': if tagItem['type']!='Emoji':

View File

@ -460,8 +460,7 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \
nickname,domain,content, \ nickname,domain,content, \
mentionedRecipients, \ mentionedRecipients, \
hashtagsDict) hashtagsDict)
content= \ content=replaceEmojiFromTagsDict(content,hashtagsDict,'content')
replaceEmojiFromTags(content,hashtagsDict,'content')
statusNumber,published = getStatusNumber() statusNumber,published = getStatusNumber()
postTo='https://www.w3.org/ns/activitystreams#Public' postTo='https://www.w3.org/ns/activitystreams#Public'