RFC: template engine [ was: Re: Implementing tables - advice wanted ]

Yariv Sadan yarivvv@REDACTED
Wed Jun 14 19:57:45 CEST 2006


Hi,

> Indeed, these four characteristics seem to be all we need and is in
> line with mine and others' intuition that a template engine should
> _not_ be a Turing complete language.

I would like to bring up one more point in favor of using Erlang as a
template language: ehtml. With an Erlang template language, you could
write code such as

<%=
       {ehtml, {table, [], {
            lists:foldl(fun(E, A) ->
                [{tr, [], {td, [{width, 20}], E#person.name}} | A]
         end, [], dict:get(people, Data))}
        }
      },
%>

in the template file. I think there's little doubt that this code does
not belong in the controller, and that an ehtml tuple generated with
pure Erlang is quite elegant.

My 2c.

Regards,
Yariv



More information about the erlang-questions mailing list