eex_html v0.2.0 EExHTML.Engine

An engine for templating HTML content.

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

Values returned are io_lists for performance reasons.

Examples

iex> EEx.eval_string("foo <%= bar %>", [bar: "baz"], engine: EExHTML.Engine)
...> |> String.Chars.to_string
"foo baz"

iex> EEx.eval_string("foo <%= bar %>", [bar: "<script>"], engine: EExHTML.Engine)
...> |> String.Chars.to_string
"foo &lt;script&gt;"

iex> EEx.eval_string("foo <%= bar %>", [bar: EExHTML.raw("<script>")], engine: EExHTML.Engine)
...> |> String.Chars.to_string
"foo <script>"

iex> EEx.eval_string("foo <%= @bar %>", [assigns: %{bar: "<script>"}], engine: EExHTML.Engine)
...> |> String.Chars.to_string
"foo &lt;script&gt;"

iex> EEx.eval_string("<%= for _ <- 1..1 do %><p><%= bar %></p><% end %>", [bar: "<script>"], engine: EExHTML.Engine)
...> |> String.Chars.to_string
"<p>&lt;script&gt;</p>"

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.