Simple and fast templating with customizable expressions in Erlang
Tested for: Erlang R17+
Simple replacement usage:
templaterl:compile(<<"I have a {{{car_model}}}.">>, [{<<"car_model">>, <<"Nissan GTR">>}]).
<<"I have a Nissan GTR.">>
Replacement with expressions:
Uppercase = "uppercase(_Token, Value) -> << <<(string:to_upper(X))>> || <<X>> <= Value >>.",
templaterl:register_helpers([Uppercase]),
templaterl:compile(<<"I have a {{{uppercase car_model}}}.">>, [{<<"car_model">>, <<"Nissan GTR">>}]).
<<"I have a NISSAN GTR.">>
Run tests by running:
rebar3 eunit
You can run benchmarks on your own machine by running:
rebar3 cmd benchmark
Results:
TODO: Add benchmark results
To run and open qcachegrind on mac OSX:
rebar3 cmd profile