UNPKG

zpt

Version:

Zenon Page Templates - JS (ZPT-JS)

74 lines (65 loc) 3.72 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>ZPT-JS reference - Attributes - TALContent</title> <script type="module" src="../js/zpt.js"></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 - TALContent</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 ::= ('structure') expression </pre> <h2 data-attributes="id 'description'">Description</h2> <p> The <em>data-content</em> inserts text or structure in place of its children. It replaces the statement element with either text or a structure (unescaped markup). The body of the statement is an expression with an optional type prefix. The value of the expression is converted into an escaped string if you prefix the expression with text or omit the prefix, and is inserted unchanged if you prefix it with structure. Escaping consists of converting “&amp;” to “&amp;amp;”, “&lt;” to “&amp;lt;”, and “&gt;” to “&amp;gt;”. </p> <p> If the expression evaluates to <code>nothing</code>, the statement element is left childless. If the expression evaluates to <code>default</code>, then the element’s contents are unchanged. </p> <p> Note: some parts extracted from <a href="https://zope.readthedocs.io/en/latest/zopebook/AppendixC.html#content-replace-the-content-of-an-element">Zope Page Templates Reference</a>. </p> <h2 data-attributes="id 'differences'">Differences with ZPT</h2> <ul> <li> <em>text</em> prefix not supported but not needed, it is the default behaviour. </li> </ul> <h2 data-attributes="id 'examples'">Examples</h2> <p> Inserting the user name: </p> <pre class="brush: html"> &lt;p data-content="user/name"&gt;Fred Farkas&lt;/p&gt; </pre> <p> Inserting HTML/XML: </p> <pre class="brush: html"> &lt;p data-content="structure myFormattedText"&gt; marked &lt;strong&gt;up&lt;/strong&gt; content goes here. &lt;/p&gt; </pre> <p> Note: extracted from <a href="https://zope.readthedocs.io/en/latest/zopebook/AppendixC.html#content-replace-the-content-of-an-element">Zope Page Templates Reference</a>. </p> </article> </div> </body> </html>