Exam >
On this page

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:

Given concordion variable ccVar = 1

Embedded command

Recommended idiomatic way.

From value attribute

embedded - no body
Let's create new variable veNoBody with the value equal to ccVar.
The following markup:
<pre e:set="#veNoBody" value="{{ccVar}}"/>
will be rendered as:
1
New variable veNoBody has value: 1

From tag body

embedded - body
Let's create new variable veBody with the value equal to concordion var = + ccVar value.
The following markup:
<pre e:set="#veBody">concordion var = {{ccVar}}</pre>
will be rendered as:
concordion var = 1
New variable veBody has value: concordion var = 1

From file

embedded - file
Let's create new variable veFile with the value equal to:
File template:  ccVar = {{ccVar}}
The following markup:
<pre e:set="#veFile" from="/data/core/file.txt"/>
will be rendered as:
File template:  ccVar = 1
New variable veFile has value: File template: ccVar = 1

Custom tag command

Not recommended legacy-style.

From value attribute

custom tag - no body
Let's create new variable vcNoBody with the value equal to ccVar.
The following markup:
<e:set var="#vcNoBody" value="{{ccVar}}"/>
will be rendered as:
1
New variable vcNoBody has value: 1

From body

custom tag - body
Let's create new variable vcBody with the value equal to: concordion var = + ccVar value.
The following markup:
<e:set var="#vcBody">concordion var = {{ccVar}}</e:set>
will be rendered as:
concordion var = 1
New variable vcBody has value: concordion var = 1

From file

custom tag - file
Let's create new variable vcFile with the value equal to:
File template:  ccVar = {{ccVar}}
The following markup:
<e:set var="#vcFile" from="/data/core/file.txt"/>
will be rendered as:
File template:  ccVar = 1
New variable vcFile has value: File template: ccVar = 1

Silent set

To set variable silently without rendering in report just set display: none style attribute.

silent
Let's create new variable v1Silent with the value equal to 1:
The following markup:
<e:set var="#v1Silent" hidden="">1</e:set>
will be rendered as:
and v2Silent with the value equal to 2:
The following markup:
<pre e:set="#v2Silent" hidden="">2</pre>
will be rendered as:

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..."

Pretty-print
Let's create new variable vPretty with the value equal to { "a" : 1 }:
The following markup:
<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 }