Template rendering facade.
Summary
Functions
Renders a Mustache template string with the given variable bindings using the configured template engine.
Renders a Mustache template and returns only the content string, discarding
render metadata. A convenience wrapper around render/3.
Renders a prompt struct's body template with the given variables, automatically incorporating the prompt's declared variable types and name.
Functions
@spec render(String.t(), map(), keyword()) :: {:ok, CommBus.Template.RenderResult.t()} | {:error, CommBus.Template.RenderError.t()}
Renders a Mustache template string with the given variable bindings using the configured template engine.
Parameters
template— A Mustache template string.values— A map of variable names to values.opts— Keyword options::engine— Template engine module (default from app config).:strict_mode— Whether to raise on missing variables (default: engine-specific).:types— Variable type declarations for coercion.:partials— Map of partial name to template body.:partials_func— Function that resolves partial names to bodies.
Returns
{:ok, %RenderResult{}} on success or {:error, %RenderError{}} on failure.
@spec render_content(String.t(), map(), keyword()) :: {:ok, String.t()} | {:error, CommBus.Template.RenderError.t()}
Renders a Mustache template and returns only the content string, discarding
render metadata. A convenience wrapper around render/3.
Parameters
template— A Mustache template string.values— A map of variable bindings.opts— Keyword options forwarded torender/3.
Returns
{:ok, content_string} on success or {:error, %RenderError{}} on failure.
@spec render_prompt(CommBus.Template.Prompt.t(), map(), keyword()) :: {:ok, CommBus.Template.RenderResult.t()} | {:error, CommBus.Template.RenderError.t()}
Renders a prompt struct's body template with the given variables, automatically incorporating the prompt's declared variable types and name.
Parameters
prompt— A%CommBus.Template.Prompt{}struct with a:bodytemplate.variables— A map of variable bindings.opts— Keyword options forwarded torender/3.
Returns
{:ok, %RenderResult{}} on success or {:error, %RenderError{}} on failure.