ZPT-JS reference - Attributes - TALOmitTag

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:

the expression evaluates to false. Otherwise the expression evaluates to true.

Note: zome parts extracted from Zope Page Templates Reference.

Differences with ZPT

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.