why template bindings must pass through a function call

Skip to first unread message


May 31, 2021, 11:11:21 AMMay 31
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Templates support instantiating bindings in the form


Thats cumbersome/confusing to non-programmers. Why not supporting the simpler:


which is what non-programmers, designers and newcomers coming from
traditional languages would expect (me too). To automagically emit a string,
just like PHP...

I modified element_template to support this. Do u think this could be integrated into nitrogen_core as it is?

to_module_callback("mobile_script") -> mobile_script;
to_module_callback("script") -> script;
to_module_callback(Tag) ->
    case re:run(Tag, "(.+?):([^\(]*)\\((.*)\\)(.*)",
                [{capture, all_but_first, list}]) of
        {match, [M, F, A, Rest]} ->
            Module = wf:to_atom(string:strip(M)),
            Function = wf:to_atom(string:strip(F)),
            ArgString = A,
            case Rest of
                [] -> [{Module, Function, ArgString}];
                _  -> [{Module, Function, ArgString}|to_module_callback(Rest)]

        nomatch ->
            [{wf, to_list, string:strip(Tag)}]

Jesse Gumm

Jun 2, 2021, 3:54:10 PMJun 2
to nitrogenweb
Hey Franklin,

Interesting, I added this functionality like 5 years ago.

I wonder if I broke something recently.


You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nitrogenweb...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nitrogenweb/759c4d52-225c-4d98-90b5-d1aff8d16548n%40googlegroups.com.


Jun 2, 2021, 9:09:06 PMJun 2
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Yeah I just noticed after updating another project. It broke. Still, the code is nice. Its simple. Im using it to compose a page using multiple templates. Its working perfect for me.

About the change, do you think thats where that feature should be placed? Or maybe avoid that indirect {wf, to_list, Arg} inlining the call immediatly.
Reply all
Reply to author
0 new messages