mirror of https://github.com/zulip/zulip.git
build_emoji: Generate emoji names and codepoints from emoji_map.
Replaces the hardcoded list of emoji_names and unicode_emoji_names in static/js/emoji.js with a list generated from emoji_map.json, both to get the list out of version control and so we can start modifying it for our autocomplete. This does not change the contents of emoji_names. It sorts and removes duplicates from unicode_emoji_names (causes no change in behavior, since unicode_emoji_names is only used as if it were a set).
This commit is contained in:
parent
762b84710e
commit
6b3abce541
|
@ -91,7 +91,8 @@
|
|||
"pm_list": false,
|
||||
"unread_ui": false,
|
||||
"user_events": false,
|
||||
"Plotly": false
|
||||
"Plotly": false,
|
||||
"emoji_codes": false
|
||||
},
|
||||
"rules": {
|
||||
"no-restricted-syntax": 1,
|
||||
|
|
|
@ -30,6 +30,7 @@ set_global('page_params', {
|
|||
|
||||
add_dependencies({
|
||||
marked: 'third/marked/lib/marked.js',
|
||||
emoji_codes: 'generated/emoji/emoji_codes.js',
|
||||
emoji: 'js/emoji.js',
|
||||
people: 'js/people.js',
|
||||
stream_data: 'js/stream_data.js',
|
||||
|
|
|
@ -6,6 +6,7 @@ set_global('page_params', {realm_emoji: {
|
|||
add_dependencies({
|
||||
Handlebars: 'handlebars',
|
||||
templates: 'js/templates',
|
||||
emoji_codes: 'generated/emoji/emoji_codes.js',
|
||||
emoji: 'js/emoji',
|
||||
i18n: 'i18next',
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -29,6 +29,21 @@ TARGET_EMOJI_DUMP = os.path.join(ZULIP_PATH, 'static', 'generated', 'emoji')
|
|||
EMOJI_CACHE_PATH = "/srv/zulip-emoji-cache"
|
||||
EMOJI_SCRIPT_DIR_PATH = os.path.join(ZULIP_PATH, 'tools', 'setup', 'emoji')
|
||||
|
||||
EMOJI_CODES_FILE_TEMPLATE = """\
|
||||
var emoji_codes = (function () {
|
||||
var exports = {};
|
||||
|
||||
exports.names = %(names)s;
|
||||
|
||||
exports.codepoints = %(codepoints)s;
|
||||
|
||||
return exports;
|
||||
}());
|
||||
if (typeof module !== 'undefined') {
|
||||
module.exports = emoji_codes;
|
||||
}
|
||||
"""
|
||||
|
||||
# change directory
|
||||
os.chdir(EMOJI_SCRIPT_DIR_PATH)
|
||||
|
||||
|
@ -209,5 +224,13 @@ def dump_emojis(cache_path):
|
|||
assets = "{}/static/assets/zulip-emoji/*".format(ZULIP_PATH)
|
||||
run(['cp', '-RPp', assets, cache_emoji], shell=True)
|
||||
|
||||
EMOJI_CODES_PATH = os.path.join(cache_path, 'emoji_codes.js')
|
||||
emoji_codes_file = open(EMOJI_CODES_PATH, 'w')
|
||||
emoji_codes_file.write(EMOJI_CODES_FILE_TEMPLATE % {
|
||||
'names': [str(name) for name in sorted(emoji_map.keys())],
|
||||
'codepoints': sorted([str(code_point) for code_point in set(emoji_map.values())])
|
||||
})
|
||||
emoji_codes_file.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
ZULIP_VERSION = "1.4.1+git"
|
||||
PROVISION_VERSION = '4.3'
|
||||
PROVISION_VERSION = '4.4'
|
||||
|
|
|
@ -773,6 +773,7 @@ JS_SPECS = {
|
|||
'node_modules/winchan/winchan.js',
|
||||
'third/handlebars/handlebars.runtime.js',
|
||||
'third/marked/lib/marked.js',
|
||||
'generated/emoji/emoji_codes.js',
|
||||
'templates/compiled.js',
|
||||
'js/feature_flags.js',
|
||||
'js/loading.js',
|
||||
|
|
Loading…
Reference in New Issue