I found, that erlydtl may be used with nitrogen.
Unfortunately, author hasn't described how he installed erlydtl to make it usable from nitrogen.
Probably somebody has ever faced with the same issue, I'm facing with. If so, please share your experience.
Thank you in advance.
You should be able to just add ErlyDTL to your app's rebar.config:
{erlydtl, ".*", {git, "git://github.com/erlydtl/erlydtl", {branch, master}}}
Then run ./rebar get-deps compile
to install it in lib/ directory of your app and recompile.
Here's the step-by-step instructions
Create a new folder to hold Nitrogen repo:
$ mkdir nitrogen-dtl
$ cd nitrodgen-dtl
Clone Nitrogen from GitHub:
git clone https://github.com/nitrogen/nitrogen.git
cd nitrogen
Build a slim (1) or a full (2) release called "dtltest" locateed in nitrogen-dtl folder:
make slim_inets PROJECT=dtltest
(1)make rel_inets PROJECT=dtltest
(2)Edit rebar.config in dtltest folder:
cd ../dtltest
vi rebar.config
add the ErlyDTL as a dependency (and a comma to the line before it):
{simple_bridge, ".*", {git, "git://github.com/nitrogen/simple_bridge",{branch, master}}},
{nprocreg, ".*", {git, "git://github.com/nitrogen/nprocreg", {branch, master}}},
{nitrogen_core, ".*", {git, "git://github.com/nitrogen/nitrogen_core",{branch, master}}},
{sync, ".*", {git, "git://github.com/rustyio/sync", {branch, master}}},
{erlydtl, ".*", {git, "git://github.com/erlydtl/erlydtl", {branch, master}}}
Download and compile dependencies with rebar:
./rebar get-deps compile
Start Nitrogen console, verify that application is running and try compiling an ErlyDTL template:
(dtltest@127.0.0.1)1> erlydtl:compile_template("<html>{{ greeting }}</html>", dtltest_template).
(dtltest@127.0.0.1)2> dtltest_template:render([{greeting, "Hallo Welt!"}]).
You should get a rendered template:
{ok,[<<"<html>">>,"Hallo Welt!",<<"</html>">>]}
If the template compiles, then ErlyDTL is installed correctly and you can use the code similar to the Gist you referenced in your application.
Cheers!