[ZPT] Proposed changes to the TAL specification
Fred Drake
fdrake at gmail.com
Thu Oct 21 12:39:35 EDT 2004
This is a proposal I've added to the ZPT wiki as:
http://zope.org/Wikis/DevSite/Projects/ZPT/RemoveInsaneConstructs
I've cleaned up the structured text markup a bit for this email, but
there really
aren't any interesting differences. I'd like to get relevant feedback soon, as
I'd like to produce the new specification and use it for Zope X3 3.1.
---------------------------------------------------------------
Proposal
The TAL 1.4 specification provides a number of loopholes for confusion.
These appear to be issues where specific combinations of TAL statements
weren't considered when the specification was written. As TAL has been
more broadly used, and especially as it's seen adoption in Zope 3, some
less carefully crafted corners of the specification have been identified.
This proposal suggests some specific improvements that should be made to
the specification, which can be folded in to create a new revision. It is
expected that at least the Zope 3 TAL interpreter can be improved as a result.
Specific Changes
- 'tal:replace' and 'tal:content' can insert new markup structures into the
output using the 'structure' keyword. The TAL 1.4 specification does not
take a stance on whether this structure should be parsed and interpreted
in any way; implementations are *allowed* to ignore embedded TAL
constructs, but are permitted to interpret them.
In the case when interpretation is permitted, attribute
replacements specified
using 'tal:attributes' are made to the first element found in
the replacement.
It is not clear that this behavior is useful, but it is very fragile.
The Zope 3 implementation attempts to support the insertion of attributes,
and does so by honoring all TAL within the replacement, but in the absence
of 'tal:attributes' does not respect TAL embedded in the
replacement structure.
PETAL (the Perl TAL/METAL implementation) does not support interpretation
of TAL in the replacement structure. I don't know about other
implementations.
The specification should be modified to disallow the interpretation of
replacement structure.
- If TAL in a replacement structure can never be interpreted,
there is no value
to ever combine 'tal:replace' and 'tal:attributes'. This should
be explicitly
identified as an error in the template. 'tal:content' and
'tal:attributes' still
makes sense.
References
"structure" and TAL interpretation
(http://mail.zope.org/pipermail/zpt/2004-July/thread.html#5441) was a thread
on the ZPT mailing list where it was generally agreed that parsing a
replacement structure was undesirable.
-Fred
--
Fred L. Drake, Jr. <fdrake at gmail.com>
Zope Corporation
More information about the ZPT
mailing list