22 lines
483 B
Elixir
22 lines
483 B
Elixir
defmodule OutlookWeb.ViewHelpers do
|
|
|
|
import Phoenix.HTML, only: [raw: 1]
|
|
|
|
@doc "Just sanitize tags"
|
|
def tidy_raw(html) when is_binary(html) do
|
|
html
|
|
|> Floki.parse_fragment!()
|
|
|> Floki.raw_html()
|
|
|> raw
|
|
end
|
|
def tidy_raw(whatever) do
|
|
whatever
|
|
end
|
|
|
|
# TODO: implement (and use) the following function
|
|
@doc "Strip <a> tags to prevent broken html (or 'breaking') from user input."
|
|
def strip_links(html) do
|
|
raise "Yet to be implemented!"
|
|
end
|
|
end
|