ExEEx (exeex v0.2.0)
Copy MarkdownDocumentation for ExEEx.
Summary
Functions
Compile template file.
Compile template file.
Render template file.
Render template string.
Functions
Compile template file.
Examples
iex> ExEEx.compile("test/templates/hello.txt").name
"hello.txt"
Compile template file.
Examples
iex> ExEEx.compile_string("Hello, world!").name
:nofile
Render template file.
Examples
iex> ExEEx.render("test/templates/hello.txt", val: "world")
"Hello, world!\n"
iex> ExEEx.render("test/templates/main.txt")
"This is header\n---\nThis is body\n---\nThis is footer\n\n"
iex> ExEEx.render("test/templates/main.txt", [{"foo", 3}])
** (ExEEx.TemplateError) expected keywords as template parameters
Render template string.
Examples
iex> ExEEx.render_string("Hello, world!")
"Hello, world!"
iex> ExEEx.render_string("<%= include \"test/templates/hello.txt\" %>OK", val: "world")
"Hello, world!
OK"
iex> ExEEx.render_string("<%= block \"header\" do %>This is default header<% end %>")
"This is default header"
iex> ExEEx.render_string("<%= block \"test\" %>")
""
iex> ExEEx.render_string("<%= block invalid %>")
** (ExEEx.TemplateError) block name should be a string literal: nofile:1.5