Syntax
argument ::= [ expression ]
Description
The data-omit-tag statement leaves the contents of an element in place while omitting the surrounding start and end tags.
If the expression evaluates to a false value, then normal processing of the element continues and the tags are not omitted. If the expression evaluates to a true value, or no expression is provided, the statement element is replaced with its contents.
If an expression evaluates to any of the next:
undefinednull'false'false0
the expression evaluates to false. Otherwise the expression evaluates to true.
Note: zome parts extracted from Zope Page Templates Reference.
Differences with ZPT
- This attribute can make some attributes not to work because they depend on an enclosing tag: data-repeat is one of them.
-
Because ZPT-JS modifies directly the template (ZPT generates a new document), these tags are REMOVED when they are not inside a macro definition. So if you update the dictionary a run ZPT-JS a second time these tags does not exist yet. If you need this to work place
data-omit-taginside a macro definition and invoke it.
Examples
Unconditionally omitting a tag:
<div data-omit-tag="" comment="This tag will be removed">
<em>...but this text will remain.</em>
</div>
Conditionally omitting a tag:
<strong data-omit-tag="not:bold">
I may be bold.
</strong>
The above example will omit the b tag if the variable bold is false.
Note: extracted from Zope Page Templates Reference.