Skip to content

Simple and fast templating with customizable expressions in Erlang

License

Notifications You must be signed in to change notification settings

gootik/templaterl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

templaterl

Simple and fast templating with customizable expressions in Erlang

Tested for: Erlang R17+

Usage

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.">>

Tests

Run tests by running:

rebar3 eunit

Benchmarks

You can run benchmarks on your own machine by running:

rebar3 cmd benchmark

Results:

TODO: Add benchmark results

Profiling

To run and open qcachegrind on mac OSX:

rebar3 cmd profile

About

Simple and fast templating with customizable expressions in Erlang

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages