UNPKG

zpt

Version:

Zenon Page Templates - JS (ZPT-JS)

95 lines (86 loc) 4.69 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>ZPT-JS reference - Attributes - TALOmitTag</title> <script type="text/javascript" src="../lib/zpt.min.js" defer></script> <script type="text/javascript" src="../js/zpt.js" defer></script> <script type="text/javascript" src="../lib/syntaxHighlighter/lib.js"></script> <link rel="stylesheet" type="text/css" href="../docs.css"> <link rel="stylesheet" type="text/css" href="../lib/syntaxHighlighter/theme.css"> </head> <body> <div data-use-macro="'page@templates.html'"> <div data-fill-slot="'page-header'"> <h1>ZPT-JS reference - Attributes - TALOmitTag</h1> <ul> <li><a href="#syntax">Syntax</a>.</li> <li><a href="#description">Description</a>.</li> <li><a href="#differences">Differences with ZPT</a>.</li> <li><a href="#examples">Examples</a>.</li> </ul> </div> <article data-fill-slot="'article'"> <h2 data-attributes="id 'syntax'">Syntax</h2> <pre class="syntax"> argument ::= [ expression ] </pre> <h2 data-attributes="id 'description'">Description</h2> <p> The <em>data-omit-tag</em> statement leaves the contents of an element in place while omitting the surrounding start and end tags. </p> <p> If the expression evaluates to a <code>false</code> value, then normal processing of the element continues and the tags are not omitted. If the expression evaluates to a <code>true</code> value, or no expression is provided, the statement element is replaced with its contents. </p> <p> If an expression evaluates to any of the next: </p> <ul> <li><code>undefined</code></li> <li><code>null</code></li> <li><code>'false'</code></li> <li><code>false</code></li> <li><code>0</code></li> </ul> <p> the expression evaluates to <code>false</code>. Otherwise the expression evaluates to <code>true</code>. </p> <p> Note: zome parts extracted from <a href="https://zope.readthedocs.io/en/latest/zopebook/AppendixC.html#omit-tag-remove-an-element-leaving-its-contents">Zope Page Templates Reference</a>. </p> <h2 data-attributes="id 'differences'">Differences with ZPT</h2> <ul> <li> This attribute can make some attributes not to work because they depend on an enclosing tag: <em>data-repeat</em> is one of them. </li> <li> Because ZPT-JS modifies directly the template (ZPT generates a new document), these tags are <strong>REMOVED</strong> 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 <code>data-omit-tag</code> inside a macro definition and invoke it. </li> </ul> <h2 data-attributes="id 'examples'">Examples</h2> <p> Unconditionally omitting a tag: </p> <pre class="brush: html"> &lt;div data-omit-tag="" comment="This tag will be removed"&gt; &lt;em&gt;...but this text will remain.&lt;/em&gt; &lt;/div&gt; </pre> <p> Conditionally omitting a tag: </p> <pre class="brush: html"> &lt;strong data-omit-tag="not:bold"&gt; I may be bold. &lt;/strong&gt; </pre> <p> The above example will omit the b tag if the variable bold is false. </p> <p> Note: extracted from <a href="https://zope.readthedocs.io/en/latest/zopebook/AppendixC.html#omit-tag-remove-an-element-leaving-its-contents">Zope Page Templates Reference</a>. </p> </article> </div> </body> </html>