Module template_compiler

Main template compiler entry points.

Copyright © 2016 Marc Worrell

Authors: Marc Worrell (marc@worrell.nl).

Description

Main template compiler entry points.

Data Types

builtin_tag()

builtin_tag() = image | image_url | image_data_url | media | url | lib

option()

option() = {runtime, atom()} | {context_name, term()} | {trace_position, {Filename::binary(), Line::integer(), Col::integer()}} | {context_vars, [binary()]}

options()

options() = [option()]

render_result()

render_result() = binary() | string() | term() | [render_result()]

template()

template() = binary() | string() | {cat, binary() | string()} | {cat, binary() | string(), term()} | {overrules, binary() | string(), file:filename_all()} | template_file()

template_file()

template_file() = #template_file{}

template_key()

template_key() = {ContextName::term(), Runtime::atom(), template()}

translation_message()

translation_message() = {Text::binary(), Args::proplists:proplist(), {Filename::file:filename(), Line::pos_integer(), Column::pos_integer()}}

Function Index

compile_binary/4Compile a in-memory template to a module.
compile_file/3Compile a template to a module.
flush/0Remove all template lookups, forces recheck.
flush_context_name/1Ping that a template has been changed.
flush_file/1Ping that a template has been changed.
get_option/2Extract compiler options and handle possible defauts.
is_template_module/1Check if the modulename looks like a module generated by the template compiler.
lookup/3Find the module of a compiled template, if not yet compiled then compile the template.
render/4Render a template.
render_block/5Render a named block, defined in a template.
translations/1Fetch all translatable strings from a template.

Function Details

compile_binary/4

compile_binary(Tpl::binary(), Filename::file:filename_all(), Options::options(), Context::term()) -> {ok, atom()} | {error, term()}

Compile a in-memory template to a module.

compile_file/3

compile_file(Filename::file:filename_all(), Options::options(), Context::term()) -> {ok, atom()} | {error, term()}

Compile a template to a module. The template is the path of the template to be compiled.

flush/0

flush() -> ok

Remove all template lookups, forces recheck.

flush_context_name/1

flush_context_name(ContextName::term()) -> ok

Ping that a template has been changed

flush_file/1

flush_file(Filename::file:filename_all()) -> ok

Ping that a template has been changed

get_option/2

get_option(Option::atom(), Options::options()) -> term()

Extract compiler options and handle possible defauts.

is_template_module/1

is_template_module(X::binary() | string() | atom()) -> boolean()

Check if the modulename looks like a module generated by the template compiler.

lookup/3

lookup(Filename::binary(), Options::options(), Context::term()) -> {ok, atom()} | {error, term()}

Find the module of a compiled template, if not yet compiled then compile the template.

render/4

render(Template::template(), Vars::map() | list(), Options::options(), Context::term()) -> {ok, render_result()} | {error, term()}

Render a template. This looks up the templates needed, ensures compilation and returns the rendering result.

render_block/5

render_block(Block::atom(), Template::template(), Vars::map() | list(), Options::options(), Context::term()) -> {ok, render_result()} | {error, term()}

Render a named block, defined in a template

translations/1

translations(Filename::file:filename_all()) -> {ok, [translation_message()]} | {error, term()}

Fetch all translatable strings from a template.


Generated by EDoc