projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
HTML: Compile Scrubbers on boot
[akkoma]
/
lib
/
pleroma
/
emoji
/
formatter.ex
diff --git
a/lib/pleroma/emoji/formatter.ex
b/lib/pleroma/emoji/formatter.ex
index acdef3988eeef967d61ef59a99a17687a4051047..4869d073e6d25abcff3992feaf75683720124d67 100644
(file)
--- a/
lib/pleroma/emoji/formatter.ex
+++ b/
lib/pleroma/emoji/formatter.ex
@@
-15,12
+15,12
@@
defmodule Pleroma.Emoji.Formatter do
def emojify(text, emoji, strip \\ false) do
Enum.reduce(emoji, text, fn
def emojify(text, emoji, strip \\ false) do
Enum.reduce(emoji, text, fn
- {_,
_, _, emoji, file
}, text ->
+ {_,
%Emoji{safe_code: emoji, safe_file: file}
}, text ->
String.replace(text, ":#{emoji}:", prepare_emoji_html(emoji, file, strip))
String.replace(text, ":#{emoji}:", prepare_emoji_html(emoji, file, strip))
-
emoji_data
, text ->
- emoji = HTML.strip_tags(
elem(emoji_data, 0)
)
- file = HTML.strip_tags(
elem(emoji_data, 1)
)
+
{unsafe_emoji, unsafe_file}
, text ->
+ emoji = HTML.strip_tags(
unsafe_emoji
)
+ file = HTML.strip_tags(
unsafe_file
)
String.replace(text, ":#{emoji}:", prepare_emoji_html(emoji, file, strip))
end)
|> HTML.filter_tags()
String.replace(text, ":#{emoji}:", prepare_emoji_html(emoji, file, strip))
end)
|> HTML.filter_tags()
@@
-40,7
+40,7
@@
defmodule Pleroma.Emoji.Formatter do
@doc "Outputs a list of the emoji-shortcodes in a text"
def get_emoji(text) when is_binary(text) do
@doc "Outputs a list of the emoji-shortcodes in a text"
def get_emoji(text) when is_binary(text) do
- Enum.filter(Emoji.get_all(), fn {emoji,
_, _, _, _
} ->
+ Enum.filter(Emoji.get_all(), fn {emoji,
%Emoji{}
} ->
String.contains?(text, ":#{emoji}:")
end)
end
String.contains?(text, ":#{emoji}:")
end)
end
@@
-50,7
+50,7
@@
defmodule Pleroma.Emoji.Formatter do
@doc "Outputs a list of the emoji-Maps in a text"
def get_emoji_map(text) when is_binary(text) do
get_emoji(text)
@doc "Outputs a list of the emoji-Maps in a text"
def get_emoji_map(text) when is_binary(text) do
get_emoji(text)
- |> Enum.reduce(%{}, fn {name,
file, _group, _, _
}, acc ->
+ |> Enum.reduce(%{}, fn {name,
%Emoji{file: file}
}, acc ->
Map.put(acc, name, "#{Pleroma.Web.Endpoint.static_url()}#{file}")
end)
end
Map.put(acc, name, "#{Pleroma.Web.Endpoint.static_url()}#{file}")
end)
end