zpt
Version:
Zenon Page Templates - JS (ZPT-JS)
78 lines (71 loc) • 3.3 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>ZPT-JS reference - Comparison expressions</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 - 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">
<p data-condition="eq: assets liabilities anObject">
true if assets, liabilities and anObject are all equals
</p>
<p data-condition="gt: 10 ( +: children pets )">
true if 10 > ( children + pets)
</p>
<p data-condition="lt: 10 ( +: children pets )">
true if 10 < ( children + pets)
</p>
<p data-condition="in: value 'option1' 'option2' 'option3'">
true if value is 'option1', 'option2' or 'option3'
</p>
<p data-condition="in: value array">
true if value is an item of array
</p>
<p data-condition="in: value 'option1' 'option2' array">
true if value is 'option1', 'option2' or an item of array
</p>
</pre>
</article>
</div>
</body>
</html>