> I was in the same position a few years ago, and started
porting TT to
> Python. While Python is nice for some things, I found
that it was
> simply too difficult to create textual code generators
for the
> language -- the significant-whitespace thing means that
you can't
> simply generate code; you need to maintain and pass
around too much
> information about things like indendation. It quickly
turned into a
> bookkeeping exercise, and got old fast.
>
> You might want to look at Jemplate[0], which is a
"port" of TT to
> Javascript. Basically, it's a small runtime engine
that executes
> precompiled templates, generated by a Template: irective
replacement
> that generates JavaScript instead of Perl. You could
do something
> similar for Python, modeled on the Jemplate model,
although you'd
> still need to deal with the whitespace thing. You'd
also have to deal
> with the fact that there is a separate compilation
step, although you
> might be able to either spin this as a feature
("It detects errors
> before you upload your templates!"), or possibly
hook Pymplate (that's
> your Python TT thingie into your
publishing process, so that new
> templates are automatically compiled as they are put
into production.
>
> In any case, I'd be interested in hearing about what
you come up with,
> as would (I imagine) others on the list.
Hopefully by mid-next-week I'll release CGI::Ex::Template
which is fully
compatible syntax wise (it is not compatible internals wise
- there is no
separate Provider, Grammer, Parser, Stash, or Context). It
doesn't generate
code. It generates an optree which is just a specific data
structure
composed of an array of arrays.
It should be fairly easy to port to other languages.
For more discussion about CGI::Ex::Template, please refer to
the warnocked
"Can there be two?" thread that started on the
5th of May.
Paul
_______________________________________________
templates mailing list
templates template-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
|