diff options
author | Guillermo Ramos | 2020-02-11 17:41:13 +0100 |
---|---|---|
committer | Guillermo Ramos | 2020-02-11 17:41:13 +0100 |
commit | c8961cafed719ae0e3113b1cc4bb1e5dac5d62d1 (patch) | |
tree | de5fc6d1c70cc2217da3671139f6a8d784ea5b73 /lib | |
parent | a4d1e9a81551dea9d8d57ba34b0f9bc7be6c9321 (diff) | |
download | waev-c8961cafed719ae0e3113b1cc4bb1e5dac5d62d1.tar.gz |
Mix format
Diffstat (limited to 'lib')
-rw-r--r-- | lib/waev_web/views/exports_view.ex | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/lib/waev_web/views/exports_view.ex b/lib/waev_web/views/exports_view.ex index 4fc9a9e..680454c 100644 --- a/lib/waev_web/views/exports_view.ex +++ b/lib/waev_web/views/exports_view.ex @@ -3,13 +3,13 @@ defmodule WaevWeb.ExportsView do def party_peek(assigns, party) do ~E""" -<div class="party-peek"> - <figure> - <%= party_avatar(assigns, party, :big) %> - <figcaption><%= party.name %></figcaption> - </figure> -</div> -""" + <div class="party-peek"> + <figure> + <%= party_avatar(assigns, party, :big) %> + <figcaption><%= party.name %></figcaption> + </figure> + </div> + """ end def party_avatar(assigns, party, size) do @@ -18,20 +18,24 @@ defmodule WaevWeb.ExportsView do :tiny -> "avatar--tiny" :big -> "avatar--big" end + ~E""" -<img class="avatar <%= modifier %>" src="<%= Routes.exports_path(@conn, :get_avatar, @id, party.name) %>" /> -""" + <img class="avatar <%= modifier %>" src="<%= Routes.exports_path(@conn, :get_avatar, @id, party.name) %>" /> + """ end def highlight_urls(nil), do: "" + def highlight_urls(text) do - url_re = ~r/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/ + url_re = + ~r/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/ url_re |> Regex.scan(text) - |> Enum.reduce(text, fn [url|_], t -> - String.replace(t, url, "<a target=\"_blank\" href=#{url}>#{url}</a>", global: false) - |> raw() + |> Enum.reduce(text, fn [url | _], t -> + t + |> String.replace(url, "<a target=\"_blank\" href=#{url}>#{url}</a>", global: false) + |> raw() end) end end |