Skip to content
Snippets Groups Projects

Update support for Unicode 15.1

Merged Brett Walker requested to merge 28-update-support-for-unicode-16-0 into main
7 unresolved threads
2 files
+ 40
44
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -24,38 +24,17 @@ module TanukiEmoji
@@ -24,38 +24,17 @@ module TanukiEmoji
JSON.parse(file.read, symbolize_names: true)
JSON.parse(file.read, symbolize_names: true)
end
end
db.each do |emoji_name, emoji_data|
db.each do |_emoji_name, emoji_data|
emoji = @index.find_by_codepoints(emoji_data[:moji])
emoji = @index.find_by_codepoints(emoji_data[:moji])
unless emoji
# if it's not found, don't try to add something that isn't in the
# search using alternates
# Unicode set.
puts "SEARCHING ALTERNATES for #{emoji_name} #{emoji_data[:moji]}"
next unless emoji
emoji_data[:unicode_alternates].each do |unicode_alternates|
next if emoji
emoji.add_alias(emoji_data[:shortname]) if emoji.alpha_code != emoji_data[:shortname]
add_emoji_data(emoji, emoji_data)
codepoints = unicode_hex_to_codepoint(unicode_alternates)
emoji = @index.find_by_codepoints(codepoints)
@index.update(emoji)
end
end
if emoji
emoji.add_alias(emoji_data[:shortname]) if emoji.alpha_code != emoji_data[:shortname]
add_emoji_data(emoji, emoji_data)
@index.update(emoji)
else
# add new emoji, or raise error
puts "ADDING NEW EMOJI for #{emoji_name} #{emoji_data[:moji]}"
emoji = Character.new(emoji_name.to_s,
codepoints: emoji_data[:moji],
alpha_code: emoji_data[:shortname],
description: emoji_data[:name],
category: emoji_data[:category])
add_emoji_data(emoji, emoji_data)
@index.add(emoji)
end
end
end
end
end
Loading