aboutsummaryrefslogtreecommitdiff
path: root/lib/waev_web
diff options
context:
space:
mode:
authorGuillermo Ramos2020-02-12 09:55:11 +0100
committerGuillermo Ramos2020-02-12 09:55:11 +0100
commit644754f48cb89743624b7bae4cf6f1992bb58305 (patch)
tree768434096dd0d20363af8b3f442f2bd9a5629db9 /lib/waev_web
parent6ce840b8d9155170b54277c83b1363d4eb42ab34 (diff)
downloadwaev-644754f48cb89743624b7bae4cf6f1992bb58305.tar.gz
Preserve newlines
Diffstat (limited to 'lib/waev_web')
-rw-r--r--lib/waev_web/templates/exports/show.html.eex2
-rw-r--r--lib/waev_web/views/exports_view.ex5
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/waev_web/templates/exports/show.html.eex b/lib/waev_web/templates/exports/show.html.eex
index 15a1360..052ced8 100644
--- a/lib/waev_web/templates/exports/show.html.eex
+++ b/lib/waev_web/templates/exports/show.html.eex
@@ -26,7 +26,7 @@
<% _ -> %>
<% end %>
- <div><%= highlight_urls(message.text) %></div>
+ <div><%= message.text |> highlight_urls() |> nl_to_br() %></div>
<div class="message-date">
<%= message.date %>
</div>
diff --git a/lib/waev_web/views/exports_view.ex b/lib/waev_web/views/exports_view.ex
index f0cfa0d..d4b8a11 100644
--- a/lib/waev_web/views/exports_view.ex
+++ b/lib/waev_web/views/exports_view.ex
@@ -39,6 +39,11 @@ defmodule WaevWeb.ExportsView do
end)
end
+ def nl_to_br(text) do
+ String.replace(text, "\n", "<br />")
+ |> raw()
+ end
+
def pagination_bar(assigns, page, size) do
prev = if page == 0, do: 0, else: page - 1
# TODO max