mirror of https://gitlab.com/bashrc2/epicyon
Adding post tags for custom emoji
parent
1e82777fdb
commit
88380b2c3c
27
content.py
27
content.py
|
@ -551,7 +551,10 @@ def _add_emoji(base_dir: str, word_str: str,
|
|||
return False
|
||||
emoji_filename = base_dir + '/emoji/' + emoji_dict[emoji] + '.png'
|
||||
if not os.path.isfile(emoji_filename):
|
||||
return False
|
||||
emoji_filename = \
|
||||
base_dir + '/emojicustom/' + emoji_dict[emoji] + '.png'
|
||||
if not os.path.isfile(emoji_filename):
|
||||
return False
|
||||
emoji_url = http_prefix + "://" + domain + \
|
||||
"/emoji/" + emoji_dict[emoji] + '.png'
|
||||
post_tags[emoji] = {
|
||||
|
@ -940,21 +943,15 @@ 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:
|
||||
if not emoji_dict.get(ename):
|
||||
emoji_dict[ename] = eitem
|
||||
# combine emoji dicts one by one
|
||||
for ename, eitem in custom_emoji_dict.items():
|
||||
if ename and eitem:
|
||||
if not emoji_dict.get(ename):
|
||||
emoji_dict[ename] = eitem
|
||||
|
||||
# print('TAG: looking up emoji for :' + word_str2 + ':')
|
||||
_add_emoji(base_dir, ':' + word_str2 + ':', http_prefix,
|
||||
|
|
Loading…
Reference in New Issue