From 5d97a4f1d3ed9e5383b1527425d0ea012df4c505 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Tue, 15 Aug 2023 13:56:44 +0200 Subject: [PATCH] chore: Move comment rendering to helper --- lib/bdfr_browser/render_utils.ex | 4 ++++ priv/templates/http/_comment.eex | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/bdfr_browser/render_utils.ex b/lib/bdfr_browser/render_utils.ex index d9964fe..f78a3ba 100644 --- a/lib/bdfr_browser/render_utils.ex +++ b/lib/bdfr_browser/render_utils.ex @@ -1,4 +1,8 @@ defmodule BdfrBrowser.RenderUtils do + def comment(cmt) do + Earmark.as_html!(cmt) + end + def message(msg) do img_replacement = "\"Image\"" diff --git a/priv/templates/http/_comment.eex b/priv/templates/http/_comment.eex index cfe1a83..cb5c187 100644 --- a/priv/templates/http/_comment.eex +++ b/priv/templates/http/_comment.eex @@ -5,7 +5,7 @@ <%= if comment.author == "AutoModerator" do %>

Hidden AutoModerator comment

<% else %> - <%= Earmark.as_html!(comment.body) %> + <%= BdfrBrowser.RenderUtils.comment(comment.body) %> <% end %>