Update tidy_raw() to ignore null values

This commit is contained in:
Thelonius Kort
2023-02-28 21:35:09 +01:00
parent e98187200a
commit dc4c8e4790

View File

@ -3,10 +3,13 @@ defmodule OutlookWeb.ViewHelpers do
import Phoenix.HTML, only: [raw: 1] import Phoenix.HTML, only: [raw: 1]
@doc "Just sanitize tags" @doc "Just sanitize tags"
def tidy_raw(html) do def tidy_raw(html) when is_binary(html) do
html html
|> Floki.parse_fragment!() |> Floki.parse_fragment!()
|> Floki.raw_html() |> Floki.raw_html()
|> raw |> raw
end end
def tidy_raw(whatever) do
whatever
end
end end