0
0
Fork 0

Add emoji from Twemoji 15.0 to the emoji picker/completion (#33395)

This commit is contained in:
Damien Erambert 2025-03-05 09:05:15 -08:00 committed by GitHub
parent b57687083f
commit debe6c0545
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 160 additions and 42 deletions

View file

@ -103,4 +103,36 @@ namespace :emojis do
gen_border map[emoji], 'white'
end
end
desc 'Download the JSON sheet data of emojis'
task :download_sheet_json do
source = 'https://raw.githubusercontent.com/iamcal/emoji-data/refs/tags/v15.1.2/emoji.json'
dest = Rails.root.join('app', 'javascript', 'mastodon', 'features', 'emoji', 'emoji_sheet.json')
puts "Downloading emoji data from source... (#{source})"
res = HTTP.get(source).to_s
data = JSON.parse(res)
filtered_data = data.map do |emoji|
filtered_item = {
'unified' => emoji['unified'],
'sheet_x' => emoji['sheet_x'],
'sheet_y' => emoji['sheet_y'],
'skin_variations' => {},
}
emoji['skin_variations']&.each do |key, variation|
filtered_item['skin_variations'][key] = {
'unified' => variation['unified'],
'sheet_x' => variation['sheet_x'],
'sheet_y' => variation['sheet_y'],
}
end
filtered_item
end
File.write(dest, JSON.generate(filtered_data))
end
end