zpt
Version:
Zenon Page Templates - JS (ZPT-JS)
52 lines (46 loc) • 2.45 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>ZPT-JS reference - Javascript 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 - Javascript 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">
js_expression ::= 'js:' string_expression_item
</pre>
<h2 data-attributes="id 'description'">Description</h2>
<p>
<em>Javascript expressions</em> evaluate arbitrary javascript code. Nowadays it is implemented using the <em>eval</em> function but this can change. Any legal Javascript expression may be evaluated.
</p>
<p>
The suplied expression is evaluated first as a <em>string expression</em> and the evaluated as javascript code.
</p>
<h2 data-attributes="id 'differences'">Differences with ZPT</h2>
<p>
<em>Javascript</em> expressions does not exist in ZPT. <em>Javascript expressions</em> work just like Python expressions in ZPT except that the Javascript language is used instead of Python.
</p>
<h2 data-attributes="id 'examples'">Examples</h2>
<pre class="brush: html">
<div data-content="js: 4 + 5">returns the int 9</div>
<div data-content="js: ${aNumber} + 1">returns the result of adding 1 to the value of aNumber variable</div>
</pre>
</article>
</div>
</body>
</html>