emoji: Update `emoji-datasource` packages.

This commit updates the `emoji-datasource` packages to version 4.0.4.
This update brings following changes to emoji infra:

1: Fix for the bleeding sprite sheets.

2: The category of some emojis has been changed. Categorywise breakup of
   net gain or loss is as follows:
    Travel & Places: 58 (gain)
    Symbols: 47 (loss)
    Smileys & People: 52 (gain)
    Objects: 11 (loss)
    Food & Drink: 3 (gain)
    Animals and Nature: 46 (gain)
    Activities: 9 (loss)

3: There were some changes in the image farm of the package which were
   breaking our old emoji farm. I fixed them by modifying the remapped
   emoji map.

Fixes: #8235.
This commit is contained in:
Harshit Bansal 2018-04-23 05:48:19 +00:00 committed by Tim Abbott
parent 6c28a60db0
commit bf70955c0c
8 changed files with 86 additions and 60 deletions

View File

@ -24,13 +24,13 @@ run_test('initialize', () => {
check_emojis(false);
}
}
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-hashtag', 228);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-car', 177);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-hashtag', 181);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-smile-o', 260);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-thumbs-o-up', 6);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-car', 119);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-smile-o', 208);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-lightbulb-o', 170);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-leaf', 153);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-cutlery', 86);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-lightbulb-o', 159);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-cutlery', 89);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-cog', 1);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-soccer-ball-o', 67);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-leaf', 107);
assert_emoji_category(complete_emoji_catalog.pop(), 'fa-soccer-ball-o', 58);
});

View File

@ -11,10 +11,11 @@
"clipboard": "2.0.1",
"css-hot-loader": "1.3.9",
"css-loader": "0.28.11",
"emoji-datasource-apple": "3.0.0",
"emoji-datasource-emojione": "3.0.0",
"emoji-datasource-google": "3.0.0",
"emoji-datasource-twitter": "3.0.0",
"clipboard": "2.0.0",
"emoji-datasource-apple": "4.0.4",
"emoji-datasource-emojione": "4.0.4",
"emoji-datasource-google": "4.0.4",
"emoji-datasource-twitter": "4.0.4",
"error-stack-parser": "2.0.1",
"expose-loader": "0.7.5",
"file-loader": "1.1.11",

View File

@ -34,11 +34,11 @@ var section_head_offsets = [];
function get_all_emoji_categories() {
return [
{ name: "Popular", icon: "fa-thumbs-o-up" },
{ name: "People", icon: "fa-smile-o" },
{ name: "Nature", icon: "fa-leaf" },
{ name: "Foods", icon: "fa-cutlery" },
{ name: "Activity", icon: "fa-soccer-ball-o" },
{ name: "Places", icon: "fa-car" },
{ name: "Smileys & People", icon: "fa-smile-o" },
{ name: "Animals & Nature", icon: "fa-leaf" },
{ name: "Food & Drink", icon: "fa-cutlery" },
{ name: "Activities", icon: "fa-soccer-ball-o" },
{ name: "Travel & Places", icon: "fa-car" },
{ name: "Objects", icon: "fa-lightbulb-o" },
{ name: "Symbols", icon: "fa-hashtag" },
{ name: "Custom", icon: "fa-cog" },

View File

@ -48,9 +48,9 @@ span.emoji
{
display: inline-block;
background-image: url('sheet_%(emojiset)s_64.png');
-webkit-background-size: 4900%%;
-moz-background-size: 4900%%;
background-size: 4900%%;
-webkit-background-size: 5200%%;
-moz-background-size: 5200%%;
background-size: 5200%%;
background-repeat: no-repeat;
/* Hide the text. */
@ -111,8 +111,8 @@ def generate_sprite_css_files(cache_path: str, emoji_data: List[Dict[str, Any]])
# those google emoji (in case anyone used them).
emoji_positions += EMOJI_POS_INFO_TEMPLATE % {
'codepoint': get_emoji_code(emoji),
'pos_x': (emoji["sheet_x"] * 100) / 48,
'pos_y': (emoji["sheet_y"] * 100) / 48,
'pos_x': (emoji["sheet_x"] * 100) / 51,
'pos_y': (emoji["sheet_y"] * 100) / 51,
}
for emojiset in EMOJISETS:
@ -144,7 +144,9 @@ def setup_emoji_farm(cache_path: str, emoji_data: List[Dict[str, Any]]) -> None:
generate_sprite_css_files(cache_path, emoji_data)
def setup_old_emoji_farm(cache_path: str, emoji_map: Dict[str, str]) -> None:
def setup_old_emoji_farm(cache_path: str,
emoji_map: Dict[str, str],
emoji_data: List[Dict[str, Any]]) -> None:
# Code for setting up old emoji farm.
os.chdir(cache_path)
emoji_cache_path = os.path.join(cache_path, 'images', 'emoji')
@ -163,7 +165,7 @@ def setup_old_emoji_farm(cache_path: str, emoji_map: Dict[str, str]) -> None:
# `remapped_emojis` is a mapping which helps in mapping `emoji_map`
# codepoints to corresponding images in new emoji farm.
remapped_emojis = get_remapped_emojis_map()
remapped_emojis = get_remapped_emojis_map(emoji_data)
for name, codepoint in emoji_map.items():
mapped_codepoint = remapped_emojis.get(codepoint, codepoint)
@ -222,7 +224,7 @@ def dump_emojis(cache_path: str) -> None:
# Setup emoji farms.
run(['rm', '-rf', cache_path])
setup_emoji_farm(cache_path, emoji_data)
setup_old_emoji_farm(cache_path, emoji_map)
setup_old_emoji_farm(cache_path, emoji_map, emoji_data)
# Generate various map files.
generate_map_files(cache_path, emoji_catalog)

View File

@ -12,19 +12,27 @@ EMOJISETS = ['apple', 'emojione', 'google', 'twitter']
# farm. `remapped_emojis` is a map that contains a mapping of their name in the old
# emoji farm to their name in the new emoji farm.
remapped_emojis = {
"0023": "0023-20e3", # Hash
"0030": "0030-20e3", # Zero
"0031": "0031-20e3", # One
"0032": "0032-20e3", # Two
"0033": "0033-20e3", # Three
"0034": "0034-20e3", # Four
"0035": "0035-20e3", # Five
"0036": "0036-20e3", # Six
"0037": "0037-20e3", # Seven
"0038": "0038-20e3", # Eight
"0039": "0039-20e3", # Nine
"1f48f": "1f469-200d-2764-200d-1f48b-200d-1f468", # Couple kiss
"1f491": "1f469-200d-2764-200d-1f468", # Couple with heart
"0023": "0023-fe0f-20e3", # Hash
"0030": "0030-fe0f-20e3", # Zero
"0031": "0031-fe0f-20e3", # One
"0032": "0032-fe0f-20e3", # Two
"0033": "0033-fe0f-20e3", # Three
"0034": "0034-fe0f-20e3", # Four
"0035": "0035-fe0f-20e3", # Five
"0036": "0036-fe0f-20e3", # Six
"0037": "0037-fe0f-20e3", # Seven
"0038": "0038-fe0f-20e3", # Eight
"0039": "0039-fe0f-20e3", # Nine
"1f1e8": "1f1e8-1f1f3", # cn
"1f1e9": "1f1e9-1f1ea", # de
"1f1ea": "1f1ea-1f1f8", # es
"1f1eb": "1f1eb-1f1f7", # fr
"1f1ec": "1f1ec-1f1e7", # gb/us
"1f1ee": "1f1ee-1f1f9", # it
"1f1ef": "1f1ef-1f1f5", # jp
"1f1f0": "1f1f0-1f1f7", # kr
"1f1f7": "1f1f7-1f1fa", # ru
"1f1fa": "1f1fa-1f1f8", # us
}
def emoji_names_for_picker(emoji_name_maps: Dict[str, Dict[str, Any]]) -> List[str]:
@ -36,7 +44,15 @@ def emoji_names_for_picker(emoji_name_maps: Dict[str, Dict[str, Any]]) -> List[s
return sorted(emoji_names)
def get_emoji_code(emoji_dict: Dict[str, Any]) -> str:
emoji_code = emoji_dict["unified"]
# Starting from version 4.0.0, `emoji_datasource` package has started to
# add an emoji presentation variation selector for certain emojis which
# have defined variation sequences. Since in informal environments(like
# texting and chat), it is more appropriate for an emoji to have a colorful
# display so until emoji characters have a text presentation selector, it
# should have a colorful display. Hence we can continue using emoji characters
# without appending emoji presentation selector.
# (http://unicode.org/reports/tr51/index.html#Presentation_Style)
emoji_code = emoji_dict["non_qualified"] or emoji_dict["unified"]
return emoji_code.lower()
# Returns a dict from categories to list of codepoints. The list of
@ -86,5 +102,12 @@ def generate_name_to_codepoint_map(emoji_name_maps: Dict[str, Dict[str, Any]]) -
name_to_codepoint[alias] = emoji_code
return name_to_codepoint
def get_remapped_emojis_map() -> Dict[str, str]:
def get_remapped_emojis_map(emoji_data: List[Dict[str, Any]]) -> Dict[str, str]:
# Extend `remapped_emojis` to include emojis whose filename from version 4
# have a emoji presentation selector(FE0F) appended to them.
for emoji_dict in emoji_data:
if emoji_dict['non_qualified'] is not None:
unified_codepoint = emoji_dict['unified'].lower()
non_qualified_codepoint = emoji_dict['non_qualified'].lower()
remapped_emojis[non_qualified_codepoint] = unified_codepoint
return remapped_emojis

View File

@ -30,11 +30,11 @@ column_names = [
'explanation',
]
category_index = {
'People': '1',
'Nature': '2',
'Foods': '3',
'Activity': '4',
'Places': '5',
'Smileys & People': '1',
'Animals & Nature': '2',
'Food & Drink': '3',
'Activities': '4',
'Travel & Places': '5',
'Objects': '6',
'Symbols': '7',
'Flags': '8',

View File

@ -8,4 +8,4 @@ ZULIP_VERSION = "1.8.1+git"
# Typically, adding a dependency only requires a minor version bump, and
# removing a dependency requires a major version bump.
PROVISION_VERSION = '23.2'
PROVISION_VERSION = '24.0'

View File

@ -1895,9 +1895,9 @@ cli-width@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639"
clipboard@2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.1.tgz#a12481e1c13d8a50f5f036b0560fe5d16d74e46a"
clipboard@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.0.tgz#4661dc972fb72a4c4770b8db78aa9b1caef52b50"
dependencies:
good-listener "^1.2.2"
select "^1.1.2"
@ -2948,21 +2948,21 @@ elliptic@^6.0.0:
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.0"
emoji-datasource-apple@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/emoji-datasource-apple/-/emoji-datasource-apple-3.0.0.tgz#1e5eb0443d0a9e20ec3ed01e77114ce601b19cec"
emoji-datasource-apple@4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/emoji-datasource-apple/-/emoji-datasource-apple-4.0.4.tgz#586048cf338623c1d64f41c0642cfb3f19552503"
emoji-datasource-emojione@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/emoji-datasource-emojione/-/emoji-datasource-emojione-3.0.0.tgz#5d5ef31d1406e4f324baef3f5932a30c7733a651"
emoji-datasource-emojione@4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/emoji-datasource-emojione/-/emoji-datasource-emojione-4.0.4.tgz#60fc4be24a70289cc4225752e38f1d700c95a160"
emoji-datasource-google@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/emoji-datasource-google/-/emoji-datasource-google-3.0.0.tgz#d6f77b56385338e10667d2b150dbe9f9b5a4e921"
emoji-datasource-google@4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/emoji-datasource-google/-/emoji-datasource-google-4.0.4.tgz#87392c07255e172e578107a9f1a3b6755907eb01"
emoji-datasource-twitter@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/emoji-datasource-twitter/-/emoji-datasource-twitter-3.0.0.tgz#4bbe192368740c72c83c4924c2ef497adec1a431"
emoji-datasource-twitter@4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/emoji-datasource-twitter/-/emoji-datasource-twitter-4.0.4.tgz#83bd4bd719205d41d2da1d7f346a093db429f036"
emojis-list@^2.0.0:
version "2.1.0"