Convert dictionary to list

main2
Bob Mottram 2019-09-23 12:55:45 +01:00
parent 372edabd3d
commit 74ceb8dd28
1 changed files with 8 additions and 4 deletions

View File

@ -1414,7 +1414,7 @@ def contentWarningScript() -> str:
'}\n' '}\n'
return script return script
def htmlReplaceEmojiFromTags(content: str,tag: {}) -> str: def htmlReplaceEmojiFromTags(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:
@ -1616,12 +1616,16 @@ def addEmojiToDisplayName(baseDir: str,httpPrefix: str, \
""" """
if ':' in displayName: if ':' in displayName:
displayName=displayName.replace('<p>','').replace('</p>','') displayName=displayName.replace('<p>','').replace('</p>','')
emojiTags=[] emojiTags={}
displayName= \ displayName= \
addHtmlTags(baseDir,httpPrefix, \ addHtmlTags(baseDir,httpPrefix, \
nickname,domain,displayName,emojiTags,{}) nickname,domain,displayName,[],emojiTags)
displayName=displayName.replace('<p>','').replace('</p>','') displayName=displayName.replace('<p>','').replace('</p>','')
displayName=htmlReplaceEmojiFromTags(displayName,emojiTags) # convert the emoji dictionary to a list
emojiTagsList=[]
for tagName,tag in emojiTags.items():
emojiTagsList.append(tag)
displayName=htmlReplaceEmojiFromTags(displayName,emojiTagsList)
return displayName return displayName
def individualPostAsHtml(iconsDir: str,translate: {}, \ def individualPostAsHtml(iconsDir: str,translate: {}, \