ExEEx (exeex v0.1.0)
Documentation for ExEEx.
Summary
Functions
Compile template file.
Compile template file.
Render template file.
Render template string.
Functions
Link to this function
adapter()
Link to this function
compile(filename, opts \\ [])
Compile template file.
Examples
iex> ExEEx.compile("test/templates/hello.txt").name
"hello.txt"
Link to this function
compile_string(source, opts \\ [])
Compile template file.
Examples
iex> ExEEx.compile_string("Hello, world!").name
:nofile
Link to this function
render(filename, params \\ [])
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
Link to this function
render_string(template, params \\ [])
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