raxx v0.15.10 EEx.HTMLEngine

An engine for templating HTML content.

Interpolated values are HTML escaped, unless the term implements the EEx.HTML.Safe protocol.

Values returned are io_lists for performance reasons.

Examples

iex> EEx.eval_string("foo <%= bar %>", [bar: "baz"], engine: EEx.HTMLEngine)
...> |> IO.iodata_to_binary()
"foo baz"

iex> EEx.eval_string("foo <%= bar %>", [bar: "<script>"], engine: EEx.HTMLEngine)
...> |> IO.iodata_to_binary()
"foo &lt;script&gt;"

iex> EEx.eval_string("foo <%= bar %>", [bar: EEx.HTML.raw("<script>")], engine: EEx.HTMLEngine)
...> |> IO.iodata_to_binary()
"foo <script>"

iex> EEx.eval_string("foo <%= @bar %>", [assigns: %{bar: "<script>"}], engine: EEx.HTMLEngine)
...> |> IO.iodata_to_binary()
"foo &lt;script&gt;"

Link to this section Summary

Functions

Callback implementation for EEx.Engine.handle_begin/1

Callback implementation for EEx.Engine.handle_body/1

Callback implementation for EEx.Engine.handle_end/1

Callback implementation for EEx.Engine.init/1

Link to this section Functions

Link to this function handle_begin(quoted)

Callback implementation for EEx.Engine.handle_begin/1.

Link to this function handle_body(quoted)

Callback implementation for EEx.Engine.handle_body/1.

Link to this function handle_end(quoted)

Callback implementation for EEx.Engine.handle_end/1.

Link to this function handle_expr(buffer, marker, expr)

Callback implementation for EEx.Engine.handle_expr/3.

Link to this function handle_text(buffer, text)

Callback implementation for EEx.Engine.handle_text/2.

Callback implementation for EEx.Engine.init/1.