raxx v0.15.10 EEx.HTML

Conveniences for generating HTML.

Link to this section Summary

Functions

Escape the HTML content derived from the given term

Escapes the given HTML to string.

iex> EEx.HTML.escape_to_binary("foo")
"foo"
iex> EEx.HTML.escape_to_binary("<foo>")
"&lt;foo&gt;"
iex> EEx.HTML.escape_to_binary("quotes: \" & \'")
"quotes: &quot; &amp; &#39;"

Escapes the given HTML to iodata.

iex> EEx.HTML.escape_to_iodata("foo")
"foo"
iex> EEx.HTML.escape_to_iodata("<foo>")
[[[] | "&lt;"], "foo" | "&gt;"]
iex> EEx.HTML.escape_to_iodata("quotes: \" & \'")
[[[[], "quotes: " | "&quot;"], " " | "&amp;"], " " | "&#39;"]

Link to this section Functions

Link to this function escape(content)

Escape the HTML content derived from the given term.

The content is returned wrapped in an EEx.HTML.Safe struct so it is not reescaped by templates etc.

Link to this function escape_to_binary(data)
escape_to_binary(String.t()) :: String.t()

Escapes the given HTML to string.

iex> EEx.HTML.escape_to_binary("foo")
"foo"
iex> EEx.HTML.escape_to_binary("<foo>")
"&lt;foo&gt;"
iex> EEx.HTML.escape_to_binary("quotes: \" & \'")
"quotes: &quot; &amp; &#39;"
Link to this function escape_to_iodata(data)
escape_to_iodata(String.t()) :: iodata()

Escapes the given HTML to iodata.

iex> EEx.HTML.escape_to_iodata("foo")
"foo"
iex> EEx.HTML.escape_to_iodata("<foo>")
[[[] | "&lt;"], "foo" | "&gt;"]
iex> EEx.HTML.escape_to_iodata("quotes: \" & \'")
[[[[], "quotes: " | "&quot;"], " " | "&amp;"], " " | "&#39;"]