Lustex v0.2.0 Lustex.Template

lua template rendering

The rendering module supports compiling and evaluating Lua-based string templates. Templates are compiled to a Lua script block and then evaluated within the specified context. Template strings may also be evaluated directly.

Link to this section Summary

Functions

compiles a string template to a Lua chunk for later evaluation

compiles a string template, throwing on error

renders a string or compiled template within the specified context map

renders a string or compiled template, throwing on error

Link to this section Functions

Link to this function compile(template, options \\ [])
compile(template :: String.t(), options :: keyword()) ::
  {:ok, Lustex.Script.compiled()} |
  {:error, any()}

compiles a string template to a Lua chunk for later evaluation

Link to this function compile!(template, options \\ [])
compile!(template :: String.t(), options :: keyword()) :: Lustex.Script.compiled()

compiles a string template, throwing on error

Link to this function render(template, context, options \\ [])
render(template :: String.t() | Lustex.Script.compiled(), context :: map(), options :: keyword()) ::
  {:ok, String.t()} |
  {:error, any()}

renders a string or compiled template within the specified context map

For options, see Lustex.Script.compile.

Link to this function render!(template, context, options \\ [])
render!(template :: String.t() | Lustex.Script.compiled(), context :: map(), options :: keyword()) :: String.t()

renders a string or compiled template, throwing on error