[ZPT] Extending tal:condition, making metal:define
Evan Simpson
evan@digicool.com
Wed, 4 Apr 2001 22:22:53 -0500
Here's two ideas I had while using ZPT today:
1. Suppose that I want to replace a tag, but only if the replacement
value exists, otherwise I want to keep the dummy text. Right now, this
is the best I can do:
<span tal:condition="exists:request/foo"
tal:replace="request/foo"></span>
<span tal:condition="not:exists:request/foo">The Text</span>
Ditto for 'content' and 'attributes'. This isn't that bad, but I
thought about extending 'condition', so that you could write:
<span tal:condition="replace exists:request/foo"
tal:replace="request/foo">The Text</span>
Grammar-wise: ([replace|content|attributes] expression)+
2. Some of the METAL paths I've been using get pretty long, and if I
wanted to use several macros from the same template it would be great to
be able to 'metal:define'. This could work the same way as
'tal:define', except at METAL time. Could be confusing, though.
Cheers,
Evan @ digicool