[Petal] Petal 0.5

Jim Fulton jim@zope.com
Wed, 07 Aug 2002 06:57:52 -0400


Evan Simpson wrote:
> Jean-Michel Hiver wrote:
> 
...

>> Another thing I've been wondering about is the 'structure' keyword. I
>> cannot figure out if it's in the TAL or the TALES specification. It
>> looks to me like a bit of a hack... Can you tell me more about it?
> 
> 
> It's part of TAL, since it is only meaningful for 'content' and 
> 'replace' and tells those statements *not* to do something they would 
> otherwise do.  Example:
> 
> <p tal:define="line string:&lt;hr&gt;">
> One <tal:line replace="line" /> Two
> <tal:line replace="structure line" /> Three
> </p>
> 
> ...becomes:
> 
> <p>
> One &lt;hr&gt; Two
> <hr> Three
> </p>
> 
> Note that 'attributes' can't have 'structure', because XML attributes 
> must be escaped.

Nother way to think about this, from a syntactical point of view
is that TAL specifies both attribute names and values. TAL specifies the
syntax of attribute values and this syntax often contains keywords
or punctuation, in *addition* to expressions. Most TAL attribute
values *only* contain expressions, but many (e.g. define) contain
other syntax.  TALES doesn't specify how attribute values are spelled, it
specified how expressions *within* attribute values are spelled.

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org