Merge pull request #8327 from tulir/emoji-variation-selectors

Add variation selector 16 to all applicable emojis
This commit is contained in:
Benoit Marty 2023-05-05 10:28:30 +02:00 committed by GitHub
commit 09e1d4d97a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 353 additions and 343 deletions

1
changelog.d/8327.bugfix Normal file
View file

@ -0,0 +1 @@
Fix duplicate reactions when using full emoji picker. Contributed by @tulir @ Beeper.

File diff suppressed because it is too large Load diff

View file

@ -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']

File diff suppressed because one or more lines are too long