Fix broken emojis.
|
@ -40,7 +40,10 @@ task "emoji:update" => :environment do
|
||||||
|
|
||||||
code = cells[1].at_css("a")["name"]
|
code = cells[1].at_css("a")["name"]
|
||||||
|
|
||||||
|
unless emojis[code]
|
||||||
|
code = code.gsub(/_fe0f/, "")
|
||||||
next unless emojis[code]
|
next unless emojis[code]
|
||||||
|
end
|
||||||
|
|
||||||
apple = cell_to_image(cells[4])
|
apple = cell_to_image(cells[4])
|
||||||
google = cell_to_image(cells[5])
|
google = cell_to_image(cells[5])
|
||||||
|
@ -50,7 +53,7 @@ task "emoji:update" => :environment do
|
||||||
if WINDOWS_FLAGS.include?(code)
|
if WINDOWS_FLAGS.include?(code)
|
||||||
windows = custom_windows_flag(code)
|
windows = custom_windows_flag(code)
|
||||||
else
|
else
|
||||||
windows = cell_to_image(cells[9])
|
windows = cell_to_image(cells[11])
|
||||||
end
|
end
|
||||||
|
|
||||||
if apple.blank? || google.blank? || twitter.blank? || one.blank? || windows.blank?
|
if apple.blank? || google.blank? || twitter.blank? || one.blank? || windows.blank?
|
||||||
|
@ -94,13 +97,16 @@ def custom_windows_flag(code)
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_emojis(emojis, aliases, style, folder)
|
def write_emojis(emojis, aliases, style, folder)
|
||||||
path = "public/images/emoji/#{folder}/"
|
path = "public/images/emoji/#{folder}"
|
||||||
|
|
||||||
FileUtils.rm_f Dir.glob("#{path}/*")
|
# Uncomment to recreate all emojis
|
||||||
|
# FileUtils.rm_f Dir.glob("#{path}/*")
|
||||||
|
|
||||||
puts folder
|
puts folder
|
||||||
|
|
||||||
emojis.values.each do |emoji|
|
emojis.values.each do |emoji|
|
||||||
|
next if emoji[style].nil?
|
||||||
|
|
||||||
write_emoji("#{path}/#{emoji[:name]}.png", emoji[style])
|
write_emoji("#{path}/#{emoji[:name]}.png", emoji[style])
|
||||||
if aliases[emoji[:name]]
|
if aliases[emoji[:name]]
|
||||||
aliases[emoji[:name]].each do |new_name|
|
aliases[emoji[:name]].each do |new_name|
|
||||||
|
@ -116,4 +122,6 @@ def write_emoji(path, emoji)
|
||||||
open(path, "wb") { |f| f << emoji }
|
open(path, "wb") { |f| f << emoji }
|
||||||
`pngout #{path}`
|
`pngout #{path}`
|
||||||
putc "."
|
putc "."
|
||||||
|
ensure
|
||||||
|
raise "Failed to write emoji: #{path}" if File.exists?(path) && !File.size?(path)
|
||||||
end
|
end
|
||||||
|
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 988 B |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 593 B |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 625 B |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 562 B |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 597 B |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 503 B |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 414 B |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 497 B |
Before Width: | Height: | Size: 820 B After Width: | Height: | Size: 454 B |
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 426 B |
Before Width: | Height: | Size: 701 B After Width: | Height: | Size: 365 B |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 464 B |
Before Width: | Height: | Size: 718 B After Width: | Height: | Size: 435 B |
Before Width: | Height: | Size: 561 B After Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 638 B After Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 740 B After Width: | Height: | Size: 451 B |
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 460 B |
Before Width: | Height: | Size: 726 B After Width: | Height: | Size: 434 B |
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 458 B |