Copyright © 2015 Hinagiku Soranoba All Rights Reserved.
assoc_data() = [{atom(), data_value()}] | [{binary(), data_value()}] | [{string(), data_value()}]
data() = assoc_data()
data_value() = data() | iodata() | number() | atom() | fun((data(), function()) -> iodata())
Function is intended to support a lambda expression.
option() = {key_type, atom | binary | string}
- key_type: Specify the type of the key in data/0. Default value is string.
abstract datatype: template()
| compile/2 | Equivalent to compile(Template, Data, []).
|
| compile/3 | Embed the data in the template. |
| parse_binary/1 | Create a template/0 from a binary. |
| parse_file/1 | Create a template/0 from a file. |
| render/2 | Equivalent to render(Bin, Data, []).
|
| render/3 | Equivalent to compile(parse_binary(Bin), Data, Options).
|
compile(Template::template(), Data::data()) -> binary()
Equivalent to compile(Template, Data, []).
compile(Mustache::template(), Data::data(), Options::[option()]) -> binary()
Embed the data in the template.
1> Template = mustache:parse_binary(<<"{{name}}">>).
2> mustache:compile(Template, #{"name" => "Alice"}).
<<"Alice">>
Data support assoc list or maps (OTP17 or later). parse_binary(Bin::binary()) -> template()
Create a template/0 from a binary.
parse_file(Filename::file:filename_all()) -> template()
Create a template/0 from a file.
render(Bin::binary(), Data::data()) -> binary()
Equivalent to render(Bin, Data, []).
See also: compile/2, parse_binary/1, parse_file/1, render/2.
Equivalent to compile(parse_binary(Bin), Data, Options).
Generated by EDoc