CommBus.Template.RenderContext (CommBus v0.1.0)

Copy Markdown View Source

Encapsulates the rendering context passed to template engines, including variable bindings, partial templates, and strict-mode configuration.

Summary

Functions

Creates a new render context from a variable map or a keyword list of options.

Types

t()

@type t() :: %CommBus.Template.RenderContext{
  partials: map(),
  strict_mode: boolean(),
  variables: map()
}

Functions

new(vars_or_opts \\ %{})

@spec new(map() | keyword()) :: t()

Creates a new render context from a variable map or a keyword list of options.

When given a map, it is used as the variable bindings. When given a keyword list, recognised keys are :variables, :partials, and :strict_mode.

Parameters

  • vars_or_opts — A map of template variables or a keyword list with :variables, :partials, and :strict_mode keys.

Returns

A %CommBus.Template.RenderContext{} struct.