Core set command
Handlebars aware set command.
Overview
Command may be used as drop-in replacements for Concordion set command when handlebars-template support is needed.
Examples
New variable could be created in the following ways:
ccVar
= 1
Embedded command
Recommended idiomatic way.
From value attribute
veNoBody
with the value equal to ccVar
.
<pre e:set="#veNoBody" value="{{ccVar}}"/>
will be rendered as:1New variable
veNoBody
has value: 1
From tag body
veBody
with the value equal to concordion var = + ccVar value.
<pre e:set="#veBody">concordion var = {{ccVar}}</pre>
will be rendered as:concordion var = 1New variable
veBody
has value: concordion var = 1
From file
veFile
with the value equal to: File template: ccVar = {{ccVar}}
<pre e:set="#veFile" from="/data/core/file.txt"/>
will be rendered as:File template: ccVar = 1New variable
veFile
has value: File template: ccVar = 1
Custom tag command
Not recommended legacy-style.
From value attribute
vcNoBody
with the value equal to ccVar
.
<e:set var="#vcNoBody" value="{{ccVar}}"/>
will be rendered as:1New variable
vcNoBody
has value: 1
From body
vcBody
with the value equal to: concordion var =
+ ccVar value
.
<e:set var="#vcBody">concordion var = {{ccVar}}</e:set>
will be rendered as:concordion var = 1New variable
vcBody
has value: concordion var = 1
From file
vcFile
with the value equal to: File template: ccVar = {{ccVar}}
<e:set var="#vcFile" from="/data/core/file.txt"/>
will be rendered as:File template: ccVar = 1New variable
vcFile
has value: File template: ccVar = 1
Silent set
To set variable silently without rendering in report just set display: none
style attribute.
v1Silent
with the value equal to 1
:
<e:set var="#v1Silent" hidden="">1</e:set>
will be rendered as:1and
v2Silent
with the value equal to 2
:
<pre e:set="#v2Silent" hidden="">2</pre>
will be rendered as:2
New variable v1Silent
has value: 1
New variable v2Silent
has value: 2
Pretty-print
Exam uses highlightjs library for code highlighting, which can be used according to documentation:
"This will find and highlight code inside of <pre><code> tags; it tries to detect the language automatically. If automatic detection doesn’t work for you, or you simply prefer to be explicit, you can specify the language manually in the using the class attribute..."
vPretty
with the value equal to { "a" : 1 }
:
<pre class="language-json">
<code e:set="#vPretty">{ "a" : 1 }</code>
</pre>
will be rendered as:{ "a" : 1 }
New variable vPretty
has value: { "a" : 1 }