X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=lib%2Fpleroma%2Femoji.ex;h=f077fe5b44ec4567cbb9014d8eb788c1c9d5f6b0;hb=b80f868c6b41d1407cf6e4f2df8913bdf7a954c0;hp=04936155b5e1419c63878f437f75c4224e687f14;hpb=8f5589cf667d8dd24da07e58db94225d81a55a7b;p=akkoma
diff --git a/lib/pleroma/emoji.ex b/lib/pleroma/emoji.ex
index 04936155b..f077fe5b4 100644
--- a/lib/pleroma/emoji.ex
+++ b/lib/pleroma/emoji.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Emoji do
@@ -102,31 +102,36 @@ defmodule Pleroma.Emoji do
:ets.insert(@ets, emojis)
end
- @external_resource "lib/pleroma/emoji-data.txt"
+ @external_resource "lib/pleroma/emoji-test.txt"
+
+ regional_indicators =
+ Enum.map(127_462..127_487, fn codepoint ->
+ <>
+ end)
emojis =
@external_resource
|> File.read!()
|> String.split("\n")
- |> Enum.filter(fn line -> line != "" and not String.starts_with?(line, "#") end)
+ |> Enum.filter(fn line ->
+ line != "" and not String.starts_with?(line, "#") and
+ String.contains?(line, "fully-qualified")
+ end)
|> Enum.map(fn line ->
line
|> String.split(";", parts: 2)
|> hd()
|> String.trim()
- |> String.split("..")
- |> case do
- [number] ->
- <>
-
- [first, last] ->
- String.to_integer(first, 16)..String.to_integer(last, 16)
- |> Enum.map(&<<&1::utf8>>)
- end
+ |> String.split()
+ |> Enum.map(fn codepoint ->
+ <>
+ end)
+ |> Enum.join()
end)
- |> List.flatten()
|> Enum.uniq()
+ emojis = emojis ++ regional_indicators
+
for emoji <- emojis do
def is_unicode_emoji?(unquote(emoji)), do: true
end