Adding post tags for custom emoji

merge-requests/30/head
Bob Mottram 2022-03-29 22:10:09 +01:00
parent 1e82777fdb
commit 88380b2c3c
2 changed files with 13 additions and 16 deletions

View File

@ -550,6 +550,9 @@ def _add_emoji(base_dir: str, word_str: str,
if not emoji_dict.get(emoji):
return False
emoji_filename = base_dir + '/emoji/' + emoji_dict[emoji] + '.png'
if not os.path.isfile(emoji_filename):
emoji_filename = \
base_dir + '/emojicustom/' + emoji_dict[emoji] + '.png'
if not os.path.isfile(emoji_filename):
return False
emoji_url = http_prefix + "://" + domain + \
@ -940,16 +943,10 @@ def add_html_tags(base_dir: str, http_prefix: str,
emoji_dict = load_json(base_dir + '/emoji/emoji.json')
# append custom emoji to the dict
if os.path.isfile(base_dir + '/emojicustom/emoji.json'):
custom_emoji_dict = \
load_json(base_dir + '/emojicustom/emoji.json')
custom_emoji_filename = base_dir + '/emojicustom/emoji.json'
if os.path.isfile(custom_emoji_filename):
custom_emoji_dict = load_json(custom_emoji_filename)
if custom_emoji_dict:
emojis_combined = True
try:
emoji_dict = dict(emoji_dict, **custom_emoji_dict)
except BaseException:
emojis_combined = False
if not emojis_combined:
# combine emoji dicts one by one
for ename, eitem in custom_emoji_dict.items():
if ename and eitem: