Emoji: Update to Unicode 13.1, switch base file, allow multichar.
This commit is contained in:
parent
5a5ff508aa
commit
1adee08321
4879
lib/pleroma/emoji-test.txt
Normal file
4879
lib/pleroma/emoji-test.txt
Normal file
File diff suppressed because it is too large
Load diff
|
@ -102,7 +102,7 @@ defp update_emojis(emojis) do
|
|||
:ets.insert(@ets, emojis)
|
||||
end
|
||||
|
||||
@external_resource "lib/pleroma/emoji-data.txt"
|
||||
@external_resource "lib/pleroma/emoji-test.txt"
|
||||
|
||||
emojis =
|
||||
@external_resource
|
||||
|
@ -114,17 +114,12 @@ defp update_emojis(emojis) do
|
|||
|> String.split(";", parts: 2)
|
||||
|> hd()
|
||||
|> String.trim()
|
||||
|> String.split("..")
|
||||
|> case do
|
||||
[number] ->
|
||||
<<String.to_integer(number, 16)::utf8>>
|
||||
|
||||
[first, last] ->
|
||||
String.to_integer(first, 16)..String.to_integer(last, 16)
|
||||
|> Enum.map(&<<&1::utf8>>)
|
||||
end
|
||||
|> String.split()
|
||||
|> Enum.map(fn codepoint ->
|
||||
<<String.to_integer(codepoint, 16)::utf8>>
|
||||
end)
|
||||
|> Enum.join()
|
||||
end)
|
||||
|> List.flatten()
|
||||
|> Enum.uniq()
|
||||
|
||||
for emoji <- emojis do
|
||||
|
|
|
@ -9,8 +9,12 @@ defmodule Pleroma.EmojiTest do
|
|||
describe "is_unicode_emoji?/1" do
|
||||
test "tells if a string is an unicode emoji" do
|
||||
refute Emoji.is_unicode_emoji?("X")
|
||||
refute Emoji.is_unicode_emoji?("ね")
|
||||
|
||||
assert Emoji.is_unicode_emoji?("☂")
|
||||
assert Emoji.is_unicode_emoji?("🥺")
|
||||
assert Emoji.is_unicode_emoji?("🤰")
|
||||
assert Emoji.is_unicode_emoji?("❤️")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue