Releases: soranoba/bbmustache
Releases · soranoba/bbmustache
Fix that the processing does not complete, when target of partial does not exist
New features
- Added new option is
raise_on_partial_miss
atbbmustache:parse_option()
#27 bbmustache:option()
split intobbmustache:parse_option()
,bbmustache:compile_option()
,bbmustache:render_option()
.
Bug fix
- Fix that the processing does not complete, when target of partial does not exist #27
More information
Added raise_on_context_miss and escape_fun options
New Feature
- #16 Added escape_fun option
- You can disable escaping or specify your own escape.
1> bbmustache:render(<<"{{tag}}">>, [{"tag", "<b>value</b>"}], [{escape_fun, fun(X) -> <<"==>", X/binary, "<==">> end}])).
<<"==><b>value</b><==">>
2> bbmustache:render(<<"{{tag}}">>, [{"tag", "<b>value</b>"}], [{escape_fun, fun(X) -> X end}])).
<<"<b>value</b>">>
- #21 Added raise_on_context_miss option
1> bbmustache:render(<<"{{#parent}}{{child}}{{/parent}}">>, [{"parent", true}], [raise_on_context_miss]).
** exception error: {context_missing,{key,<<"child">>}}
Bug Fixes
Support the context stack
e.g.
1> Map = #{"a" => #{"one" => 1},
1> "b" => #{"two" => 2},
1> "c" => #{"three" => 3}}.
#{"a" => #{"one" => 1},"b" => #{"two" => 2},"c" => #{"three" => 3}}
2> Template = <<"{{#a}}"
2> "{{one}}"
2> "{{#b}}"
2> "{{one}}{{two}}{{c.three}}"
2> "{{/b}}"
2> "{{/a}}">>.
<<"{{#a}}{{one}}{{#b}}{{one}}{{two}}{{c.three}}{{/b}}{{/a}}">>
3> bbmustache:render(Template, Map).
<<"1123">>
See also:
#17
https://github.com/mustache/spec/blob/v1.1.3/specs/sections.yml#L56-L93
FIX it isn't sometimes escape.
e.g.
% v1.3.0
1> bbmustache:render(<<"{{{message}}world}">>, #{"message"=>"<s>hello</s>"}).
<<"{<s>hello</s>world}">>
% v1.3.1
2> bbmustache:render(<<"{{{message}}world}">>, #{"message"=>"<s>hello</s>"}).
<<"{<s>hello</s>, }">>
Performance improvements and some fixes
- About 1.6 times will be faster.
- Since the intermediate format is changed, please do NOT update with hot code.
- The interface isn't change.
New features
- Support the delimiter that is three or more characters.
Bug fix
Additions and fixes for the mustache specs.
- Support the dotted names. (child's variables)
- Support the recursive partials.
- Support the indent in partials.
- Change the escape characters. #13
- Reset the delimiters in the partial sections.
- If the tag including the space has been specified, it became to delete the space.
- Change of the processing of the new line.
- Support the proplist that include empty tuple :
[{}]
You can find the change logs with more detailed info at: #14
Support for rendering plain lists.
Library name was changed "mustache" into "bbmustache"
mustache.erl
->bbmustache.erl
- All function is not changed.
- If you want to use
mustache.erl
yet, please use the v0.3.3 (but this is not supported)
It support atom and binary as key.
It supports assoc list in addition to maps
v0.2.0 Merge remote-tracking branch 'origin/feature/support-assoc-list'