looking for template package
Robert Kern
robert.kern at gmail.com
Wed Mar 4 16:09:27 EST 2009
On 2009-03-03 20:06, Neal Becker wrote:
> I'm looking for something to do template processing. That is, transform
> text making various substitutions. I'd like to be able to do substitutions
> that include python expressions, to do arithmetic computations within
> substitutions.
>
> I know there are lots of template packages, but most seem aimed at web use.
> This is just text processing, not part of any web stuff.
>
> Any suggestions?
For this kind of purpose, I like Ian Bicking's Tempita. It's a single Python
file and allows basically arbitrary Python. It has a Django-ish syntax without
all of the restrictions that Django templates will impose on you.
http://pythonpaste.org/tempita/
If you find you need template inheritance, though, it would be worth your while
to upgrade to a fuller templating package. I like Mako for that.
http://makotemplates.org/
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list