Add variation selector 16 to all applicable emojis in import script

Signed-off-by: Tulir Asokan <tulir@maunium.net>
This commit is contained in:
Tulir Asokan 2023-04-12 21:43:54 +03:00
parent 110b5cfcb4
commit 91ed82749c
1 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,13 @@ print("Fetching emoji list from Unicode.org...")
req = requests.get("https://unicode.org/emoji/charts/emoji-list.html") req = requests.get("https://unicode.org/emoji/charts/emoji-list.html")
soup = BeautifulSoup(req.content, 'html.parser') 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 # Navigate to table
table = soup.body.table table = soup.body.table
@ -121,6 +128,8 @@ for emoji in emoji_picker_datasource_emojis:
new_keywords.pop(keyword) new_keywords.pop(keyword)
# Write new keywords back # Write new keywords back
emoji_picker_datasource_emojis[emoji]["j"] = list(new_keywords.keys()) 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) # 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'] emoji_picker_datasource['categories'] = [x for x in emoji_picker_datasource['categories'] if x['id'] != 'component']