z_template (zotonic_core v1.0.0-rc.10)

Template handling, compiles and renders django compatible templates using the template_compiler

Link to this section Summary

Functions

Return a list of all block names in a template.
Check if the modulename looks like a module generated by the template compiler.
Observer, triggered when there are new module files indexed
Render a block template to an iolist().
Render a template to an iolist(). This removes all scomp state etc from the rendered html and appends the information in the scomp states to the context for later rendering.
Force a reset of all templates, used after a module has been activated or deactivated.

Link to this section Functions

Link to this function

blocks(Module_index, Vars, Context)

-spec blocks(template_compiler:template() | #module_index{}, map(), z:context()) ->
          {ok, [atom()]} | {error, term()}.
Return a list of all block names in a template.
Link to this function

is_template_module(Module)

-spec is_template_module(binary() | string() | atom()) -> boolean().
Check if the modulename looks like a module generated by the template compiler.
Link to this function

module_reindexed(_, Context)

-spec module_reindexed(module_reindexed, #context{}) -> ok.
Observer, triggered when there are new module files indexed
Link to this function

render(Render, Context)

-spec render(#render{}, #context{}) -> template_compiler:render_result().
Link to this function

render(Template, Vars, Context)

-spec render(template_compiler:template() | #module_index{}, list() | map(), #context{}) ->
          template_compiler:render_result().
Link to this function

render_block(Block, Render, Context)

-spec render_block(atom(), #render{}, #context{}) -> template_compiler:render_result().
Link to this function

render_block(OptBlock, Template, Vars, Context)

-spec render_block(atom(), template_compiler:template() | #module_index{}, list() | map(), #context{}) ->
                template_compiler:render_result().
Link to this function

render_block_to_iolist(Block, File, Vars, Context)

-spec render_block_to_iolist(atom(), template_compiler:template(), list() | map(), z:context()) ->
                          {iolist(), z:context()}.
Render a block template to an iolist().
Link to this function

render_to_iolist(File, Vars, Context)

-spec render_to_iolist(template_compiler:template() | #module_index{}, list() | map(), z:context()) ->
                    {iolist(), z:context()}.
Render a template to an iolist(). This removes all scomp state etc from the rendered html and appends the information in the scomp states to the context for later rendering.
-spec reset(atom() | #context{}) -> ok.
Force a reset of all templates, used after a module has been activated or deactivated.
Link to this function

start_link(Site)