[Web-SIG] Standardized template API
Ian Bicking
ianb at colorstudy.com
Tue Jan 31 04:44:34 CET 2006
Peter Hunt wrote:
> I think all it would take is a Web-Sig (and perhaps a PEP) blessing the
> TurboGears template engine plugin API [1].
>
> Thoughts?
>
> Peter Hunt
>
> [1] http://www.turbogears.org/docs/plugins/template.html
I concur. I've started using it in a project of mine. There's a couple
things I'd like to add that have come up on the TG list:
* Add "template_file" and "template_string" arguments to .render(),
which take filenames and strings.
* Add a find_template callback, which given a filename can, for
instance, use a search path to find the file. So the framework or
application would pass this function into the plugin somehow. Maybe
this could be extended some for use in situations where templates aren't
found on the filesystem.
* Add some methods for quoting -- one for text that is already a
HTML/XML literal, and one for text that should be quoted. Some
templates default one way (quote everything unless explicitly asked not
to in some way), and some the other way (include everything as though it
is markup, unless explicitly quoting it). This makes it possible --
though not incredibly easy -- to write some template-language-neutral
libraries. I would assume most applications would actually be written
to a specific templating language, so this is only for libraries that go
out of their way to be neutral.
--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
More information about the Web-SIG
mailing list