Add emoji from Twemoji 15.0 to the emoji picker/completion (#33395)
This commit is contained in:
parent
b57687083f
commit
debe6c0545
12 changed files with 160 additions and 42 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue