From 91ed82749c5b0794a3d491ddf50dd706e749673a Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 12 Apr 2023 21:43:54 +0300 Subject: [PATCH] Add variation selector 16 to all applicable emojis in import script Signed-off-by: Tulir Asokan --- tools/import_emojis.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/import_emojis.py b/tools/import_emojis.py index 5138c25c68..66bcd45015 100755 --- a/tools/import_emojis.py +++ b/tools/import_emojis.py @@ -26,6 +26,13 @@ print("Fetching emoji list from Unicode.org...") req = requests.get("https://unicode.org/emoji/charts/emoji-list.html") soup = BeautifulSoup(req.content, 'html.parser') +variation_sequence_data = requests.get("https://www.unicode.org/Public/15.0.0/ucd/emoji/emoji-variation-sequences.txt").text +variation_sequence_overrides = {} +for line in variation_sequence_data.split("\n"): + if "emoji style" in line: + emoji_hex = line.split(" ", 1)[0] + variation_sequence_overrides[emoji_hex] = emoji_hex + "-FE0F" + # Navigate to table table = soup.body.table @@ -121,6 +128,8 @@ for emoji in emoji_picker_datasource_emojis: new_keywords.pop(keyword) # Write new keywords back emoji_picker_datasource_emojis[emoji]["j"] = list(new_keywords.keys()) + if emoji_code in variation_sequence_overrides: + emoji_picker_datasource_emojis[emoji]["b"] = variation_sequence_overrides[emoji_code] # Filter out components from unicode 13.1 (as they are not suitable for single-emoji reactions) emoji_picker_datasource['categories'] = [x for x in emoji_picker_datasource['categories'] if x['id'] != 'component']