Since: Concordion 2.0.0 The execute command is expressed using the syntax: [value](- "expression")
or [value](- 'expression')
which executes the expression
(as long as expression
doesn't start with c:
as described below).
You can also use the long-hand [value](- 'c:execute=expression')
variant if you wish.
Markdown | Resultant HTML |
---|---|
[When I apply](- "apply()") | <span concordion:execute="apply()">When I apply</span> |
[the time is](- "setTime(#date, #time)") | <span concordion:execute="setTime(#date, #time)">the time is</span> |
[The greeting for](- "#msg=getGreeting()") | <span concordion:execute="#msg=getGreeting()">The greeting for</span> |
[The greeting for](- "#msg=greeting") | <span concordion:execute="#msg=greeting">The greeting for</span> |
[Do something](- 'c:execute=doSomething()') | <span concordion:execute="doSomething()">Do something</span> |
If the special variable #TEXT
is used as a parameter within the expression, Concordion will pass the value as the parameter.
Markdown | Resultant HTML |
---|---|
[09:00AM](- "setCurrentTime(#TEXT)") | <span concordion:execute="setCurrentTime(#TEXT)">09:00AM</span> |
To run the execute command on a table, the execute command is specified in the first table header column, followed by the command for that column (if any), with the commands for each column of the table specified in the table header.
Markdown | Resultant HTML |
---|---|
|[ ](- "#z=add(#x, #y)")[Number 1](- "#x")|[Number 2](- "#y")|[Result](- "?=#z")| | --------------------------------------: | ---------------: | ---------------: | | 1| 0| 1| | 1| -3| -2| |
<table concordion:execute="#z=add(#x, #y)"> <thead> <tr><th align="right" concordion:set="#x">Number 1</th><th align="right" concordion:set="#y">Number 2</th><th align="right" concordion:assert-equals="#z">Result</th></tr> </thead> <tbody> <tr><td align="right"> 1</td><td align="right"> 0</td><td align="right"> 1</td></tr> <tr><td align="right"> 1</td><td align="right"> -3</td><td align="right"> -2</td></tr> </tbody> </table> |
Using reference style links can make the Markdown source for the table more readable:
Markdown | Resultant HTML |
---|---|
|[add][][Number 1](- "#x")|[Number 2](- "#y")|[Result](- "?=#z")| | ----------------------: | ---------------: | ---------------: | | 4| 3| 7| [add]: - "#z=add(#x, #y)" | <table concordion:execute="#z=add(#x, #y)"> <thead> <tr><th align="right" concordion:set="#x">Number 1</th><th align="right" concordion:set="#y">Number 2</th><th align="right" concordion:assert-equals="#z">Result</th></tr> </thead> <tbody> <tr><td align="right"> 4</td><td align="right"> 3</td><td align="right"> 7</td></tr> </tbody> </table> |
or even:
Markdown | Resultant HTML |
---|---|
|[add][][Number 1][]|[Number 2][]|[Result][]| | ----------------: | ---------: | -------: | | 4| 3| 7| [Number 1]: - "#x" [Number 2]: - "#y" [add]: - "#z=add(#x, #y)" [Result]: - "?=#z" | <table concordion:execute="#z=add(#x, #y)"> <thead> <tr><th align="right" concordion:set="#x">Number 1</th><th align="right" concordion:set="#y">Number 2</th><th align="right" concordion:assert-equals="#z">Result</th></tr> </thead> <tbody> <tr><td align="right"> 4</td><td align="right"> 3</td><td align="right"> 7</td></tr> </tbody> </table> |
To run each row of the table as an example, add a "c:example" command to a column header. The text in that column will be used for the example name.
For example:
Markdown | Resultant HTML |
---|---|
|[ ](- "#z=add(#x, #y)")[Description](- "c:example") | [Number 1](- "#x")|[Number 2](- "#y")|[Result](- "?=#z")| | -------------------------- | ----------------: | ---------------: | ---------------: | | Positive numbers | 1| 0| 1| | Negative numbers | 1| -3| -2| |
<table concordion:execute="#z=add(#x, #y)"> <thead> <tr><th concordion:example="">Description</th><th align="right" concordion:set="#x">Number 1</th><th align="right" concordion:set="#y">Number 2</th><th align="right" concordion:assert-equals="#z">Result</th></tr> </thead> <tbody> <tr><td> Positive numbers </td><td align="right"> 1</td><td align="right"> 0</td><td align="right"> 1</td></tr> <tr><td> Negative numbers </td><td align="right"> 1</td><td align="right"> -3</td><td align="right"> -2</td></tr> </tbody> </table> |
If you don't want each row to be treated identically, you can annotate specific cells within the table.
Markdown | Resultant HTML |
---|---|
| Number | | ----------- | | [1](- "#x") | | [3](- "#y") | |
<table> <thead> <tr><th> Number </th></tr> </thead> <tbody> <tr><td> <span concordion:set="#x">1</span> </td></tr> <tr><td> <span concordion:set="#y">3</span> </td></tr> </tbody> </table> |