Adding post tags for custom emoji

main
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

@ -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,

View File

@ -6756,7 +6756,7 @@ def _test_bold_reading() -> None:
def run_all_tests():
base_dir = os.getcwd()
base_dir = os.getcwd()
print('Running tests...')
update_default_themes_list(os.getcwd())
_test_source_contains_no_tabs()