UNPKG

zpt

Version:

Zenon Page Templates - JS (ZPT-JS)

79 lines (72 loc) 3.39 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>ZPT-JS reference - Comparison expressions</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 - Comparison expressions</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"> comparison_expressions ::= ( 'eq:' | 'gt:' | 'lt:' | 'in:' ) expression expression [ expression ]* </pre> <h2 data-attributes="id 'description'">Description</h2> <p> The available comparison expressions are: </p> <ul> <li><code>eq:</code> -> checks if 2 or more integers are equals. If the values are not numbers, it checks if they are equals.</li> <li><code>gt:</code> -> checks if a number is greater than another.</li> <li><code>lt:</code> -> checks if a number is lower than another.</li> <li><code>in:</code> -> checks if a value is in a list of expressions.</li> </ul> <p> All operators uses lazy evaluation. All expressions support 2 or more operators. Parenthesis can be used. </p> <h2 data-attributes="id 'differences'">Differences with ZPT</h2> <p> This expressions does not exist in ZPT. </p> <h2 data-attributes="id 'examples'">Examples</h2> <p> Some examples in <em>data-condition</em>: </p> <pre class="brush: html"> &lt;p data-condition="eq: assets liabilities anObject"&gt; true if assets, liabilities and anObject are all equals &lt;/p&gt; &lt;p data-condition="gt: 10 ( +: children pets )"&gt; true if 10 &gt; ( children + pets) &lt;/p&gt; &lt;p data-condition="lt: 10 ( +: children pets )"&gt; true if 10 &lt; ( children + pets) &lt;/p&gt; &lt;p data-condition="in: value 'option1' 'option2' 'option3'"&gt; true if value is 'option1', 'option2' or 'option3' &lt;/p&gt; &lt;p data-condition="in: value array"&gt; true if value is an item of array &lt;/p&gt; &lt;p data-condition="in: value 'option1' 'option2' array"&gt; true if value is 'option1', 'option2' or an item of array &lt;/p&gt; </pre> </article> </div> </body> </html>