[Petal] condition="true:" superfluous ?
Jonathan Vanasco
petal-list at 2xlp.com
Sun Sep 17 01:22:26 BST 2006
The Petal docs /cookbook are split evenly in use between
tal:condition="x"
tal:condition="true: x"
Most notably, the 'condition' docs use 'true:' while the repeat docs
do not.
And the true:EXPRESSION Petal docs say:
"the true: modifiers should always be used when doing Petal
conditions."
that looked odd, so I looked onto the ZPT website for futher
clarification
According to the Tal 1.4 specs, which are pretty sparse,
tal:condition implies a 'true:' already -- making including it
superfluous. true is supported in all of the implementations as a
base modifier, but using it is not necessary in condition
based on that, i'd like to suggest the following changes to the Petal
docs:
TAL Syntax
condition (ifs )
[ ] remove 'true:' from the abstract and example
[ ] Append to this line:
Conditions can be used to display something if an expression is
true. They can also be used to check that a list exists before
attempting to loop through it.
this text:
TAL assumes conditions are checked to be true-- using the
modifer 'true:' is not required, but will have no affect if
included. To test if something is not true, use the modifier 'not:'
or 'false'.
Expressions & Modifiers
true: EXPRESSION
[ ] remove this line, as it conflicts with other docs and is wrong
the true: modifiers should always be used when doing Petal
conditions
false: EXPRESSION
[ ] add this line
false: is Petal's implementation of a negative boolean check
using perlish semantics. The original python TAL specification uses
not: , which is more pythonic.
Different TAL engines have decided to implement this modifier in
different ways-- some use not: , some use false:. Petal supports both.
If you need to use your TAL templates with another engine, be
aware that you may have to create a custom modifier to support false
or not.
[ ] also add after this:
not: EXPRESSION
see false: EXPRESSION above
More information about the Petal
mailing list