[ZPT] Any news on Template Style Sheet Language?
evan at 4-am.com
Mon Dec 6 17:29:32 EST 2004
Ian Bicking wrote:
> I don't know if I actually have a point. I'm not anti-TERSE or
> anything. I'm trying to understand what TERSE accomplishes, and if
> there's a way to accomplish the same thing through Python instead of
> introducing another language to the mix.
For certain values of "the same thing", sure! Now that you've reminded
me, I recall that one of my vaporous to-do items for TERSE is to expose
the API by which rulesets are constructed, making the mini-language a
relatively simple matter of parsing text and then calling API functions.
You could then, of course, skip the mini-language and just use the API.
Setting the mini-language to one side for the moment, the core idea of
TERSE is to allow TAL-style templating, but factored out of the actual
document. By "TAL-style", I mean that you are treating document
elements as fundamental units, both of text transformations and of
variable scope. You need a way to identify elements, and a way to
associate transformations with them. Simple getElementById() and pre-
and post- callbacks would certainly be one way to accomplish this.
> Since TERSE is a new language that integrates with an existing language
> (a couple existing languages, actually), the implementation is very
> important. There's a lot of subtle and potentially problematic
> interferences between all those languages (TERSE being added to TALES,
> TAL, METAL, and Python; building on TALES and Python, and directly
> manipulating TAL).
The nice thing about TAL and METAL is that they are very small, simple
languages with barely any syntax that isn't dictated by XML, and their
interaction is governed entirely by element nesting. Part of the
motivation of TERSE's design was to play nicely with this setup, by
simply extending the list-of-statements-attached-to-an-element model.
The complications are all related to how you order the statements coming
from various rules and from the document itself.
Evan @ 4-am
More information about the ZPT