Add finmoji.
|
@ -22,4 +22,76 @@ def parse_mentions(text) do
|
|||
|> Enum.map(fn ("@" <> match = full_match) -> {full_match, User.get_cached_by_nickname(match)} end)
|
||||
|> Enum.filter(fn ({_match, user}) -> user end)
|
||||
end
|
||||
|
||||
def finmojifiy(text) do
|
||||
emoji_list = [
|
||||
"a_trusted_friend",
|
||||
"alandislands",
|
||||
"association",
|
||||
"auroraborealis",
|
||||
"baby_in_a_box",
|
||||
"bear",
|
||||
"black_gold",
|
||||
"christmasparty",
|
||||
"crosscountryskiing",
|
||||
"cupofcoffee",
|
||||
"education",
|
||||
"fashionista_finns",
|
||||
"finnishlove",
|
||||
"flag",
|
||||
"forest",
|
||||
"four_seasons_of_bbq",
|
||||
"girlpower",
|
||||
"handshake",
|
||||
"happiness",
|
||||
"headbanger",
|
||||
"icebreaker",
|
||||
"iceman",
|
||||
"joulutorttu",
|
||||
"kaamos",
|
||||
"kalsarikannit_f",
|
||||
"kalsarikannit_m",
|
||||
"karjalanpiirakka",
|
||||
"kicksled",
|
||||
"kokko",
|
||||
"lavatanssit",
|
||||
"losthopes_f",
|
||||
"losthopes_m",
|
||||
"mattinykanen",
|
||||
"meanwhileinfinland",
|
||||
"moominmamma",
|
||||
"nordicfamily",
|
||||
"out_of_office",
|
||||
"peacemaker",
|
||||
"perkele",
|
||||
"pesapallo",
|
||||
"polarbear",
|
||||
"pusa_hispida_saimensis",
|
||||
"reindeer",
|
||||
"sami",
|
||||
"sauna_f",
|
||||
"sauna_m",
|
||||
"sauna_whisk",
|
||||
"sisu",
|
||||
"stuck",
|
||||
"suomimainittu",
|
||||
"superfood",
|
||||
"swan",
|
||||
"the_cap",
|
||||
"the_conductor",
|
||||
"the_king",
|
||||
"the_voice",
|
||||
"theoriginalsanta",
|
||||
"tomoffinland",
|
||||
"torillatavataan",
|
||||
"unbreakable",
|
||||
"waiting",
|
||||
"white_nights",
|
||||
"woollysocks"
|
||||
]
|
||||
|
||||
Enum.reduce(emoji_list, text, fn (emoji, text) ->
|
||||
String.replace(text, ":#{String.replace(emoji, "_", "")}:", "<img height='32px' width='32px' alt='#{emoji}' title='#{emoji}' src='#{Pleroma.Web.Endpoint.static_url}/finmoji/128px/#{emoji}-128.png' />")
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ defmodule Pleroma.Web.Endpoint do
|
|||
at: "/media", from: "uploads", gzip: false
|
||||
plug Plug.Static,
|
||||
at: "/", from: :pleroma,
|
||||
only: ~w(index.html static)
|
||||
only: ~w(index.html static finmoji)
|
||||
|
||||
# Code reloading can be explicitly enabled under the
|
||||
# :code_reloader configuration of your endpoint.
|
||||
|
|
|
@ -22,6 +22,7 @@ def format_input(text, mentions) do
|
|||
|> Formatter.linkify
|
||||
|> String.replace("\n", "<br>\n")
|
||||
|> add_user_links(mentions)
|
||||
|> Formatter.finmojifiy
|
||||
end
|
||||
|
||||
def add_user_links(text, mentions) do
|
||||
|
|
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 280 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 135 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 173 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 372 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 144 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 194 KiB |
After Width: | Height: | Size: 139 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 159 KiB |
After Width: | Height: | Size: 133 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 162 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 77 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 178 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 125 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 222 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 161 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 12 KiB |