View Source template_compiler_runtime_internal (template_compiler v3.5.0)

Callback routines for compiled templates.

Summary

Functions

Call the block function, lookup the function in the BlockMap to find the correct module.

Call the block function of the template the current module extends.

Call a module's render function.

Echo the HTML escape value within <pre> tags.

Make an unique string (about 11 characters). Used for expanding unique args in templates. The string only consists of the characters A-Z and 0-9 and is safe to use as HTML element id.

Assign variables from a with statement. Care has to be taken for unpacking tuples and lists.

Functions

block_call(SrcPos, Block, Vars, BlockMap, Runtime, Context)

-spec block_call({binary(), integer(), integer()}, atom(), map(), map(), atom(), term()) -> term().

Call the block function, lookup the function in the BlockMap to find the correct module.

block_inherit(SrcPos, Module, Block, Vars, BlockMap, Runtime, Context)

-spec block_inherit({binary(), integer(), integer()}, term(), atom(), map(), map(), atom(), term()) ->
                       term().

Call the block function of the template the current module extends.

call(Module, Args, Vars, Context)

-spec call(Module :: atom(), Args :: map(), Vars :: map(), Context :: term()) ->
              template_compiler:render_result().

Call a module's render function.

compose(SrcPos, Template, Args, Runtime, ContextVars, IsContextVars, Vars, BlockList, BlockModule, BlockFun, Context)

-spec compose(SrcPos, Template, Args, Runtime, ContextVars, IsContextVars, Vars, BlockList, BlockModule,
              BlockFun, Context) ->
                 Output
                 when
                     SrcPos :: {File :: binary(), Line :: integer(), Col :: integer()},
                     Template :: template_compiler:template(),
                     Args :: [{atom(), term()}],
                     Runtime :: atom(),
                     ContextVars :: [binary()],
                     IsContextVars :: boolean(),
                     Vars :: map(),
                     BlockList :: [atom()],
                     BlockModule :: atom(),
                     BlockFun :: function(),
                     Context :: term(),
                     Output :: template_compiler:render_result().

Compose include of a template, with overruling blocks.

debug_checkpoint(SrcPos, Vars, Runtime, Context)

-spec debug_checkpoint({binary(), integer(), integer()}, map(), atom(), term()) -> ok.

forloop(IsForloopVar, ListExpr, LoopVars, LoopBody, EmptyPart, Runtime, IsContextVars, Vars, Context)

-spec forloop(IsForloopVar :: boolean(),
              ListExpr :: term(),
              LoopVars :: [atom()],
              LoopBody :: fun(),
              EmptyPart :: fun(),
              Runtime :: atom(),
              IsContextVars :: boolean(),
              Vars :: map(),
              Context :: term()) ->
                 term().

Runtime implementation of a forloop.

include(SrcPos, Method, Template, Args, Runtime, ContextVars, IsContextVars, Vars, Context)

-spec include(SrcPos, Method, Template, Args, Runtime, ContextVars, IsContextVars, Vars, Context) ->
                 Output
                 when
                     SrcPos :: {File :: binary(), Line :: integer(), Col :: integer()},
                     Method :: normal | optional | all,
                     Template :: template_compiler:template() | undefined,
                     Args :: [{atom(), term()}],
                     Runtime :: atom(),
                     ContextVars :: [binary()],
                     IsContextVars :: boolean(),
                     Vars :: map(),
                     Context :: term(),
                     Output :: template_compiler:render_result().

Include a template.

merge_blocks(BlockList, BlockOwner, TraceModule, BlockFun, BlockMap)

print(Expr)

-spec print(term()) -> iolist().

Echo the HTML escape value within <pre> tags.

unique()

-spec unique() -> binary().

Make an unique string (about 11 characters). Used for expanding unique args in templates. The string only consists of the characters A-Z and 0-9 and is safe to use as HTML element id.

with_vars(Vs, Es, Vars)

-spec with_vars([atom()], [term()], map()) -> map().

Assign variables from a with statement. Care has to be taken for unpacking tuples and lists.