... | @@ -68,7 +68,7 @@ Last but not least, the optional **`<backgroundColour>`** allows determining the |
... | @@ -68,7 +68,7 @@ Last but not least, the optional **`<backgroundColour>`** allows determining the |
|
Macros play a crucial role in object templating. In the [Getting started](Getting-started) section we briefly mentioned the concept of templating. [Templates](authoring/Templates) can be compared to a blueprint or a mould to produce a number of similar objects, sharing some but not all properties with their siblings. Values for the differentiating properties are generally provided by individual **template variables**, identified by the **`$`** (dollar) sign and a pair of enclosing **{}** (brackets), or more complex expressions involving multiple variables. If an expression is being used in multiple locations, it is advisable to define the expression only once in the form of a **`<macro>`** and replace each occurrence of the given expression with the corresponding macro. Macros use a notation for their placeholder similar to template variables. Macro placeholders are identified by the **`%`** (percent) sign and a pair of enclosing **{}** (brackets). The following example defines a macro named **CriterionStartAngle**.
|
|
Macros play a crucial role in object templating. In the [Getting started](Getting-started) section we briefly mentioned the concept of templating. [Templates](authoring/Templates) can be compared to a blueprint or a mould to produce a number of similar objects, sharing some but not all properties with their siblings. Values for the differentiating properties are generally provided by individual **template variables**, identified by the **`$`** (dollar) sign and a pair of enclosing **{}** (brackets), or more complex expressions involving multiple variables. If an expression is being used in multiple locations, it is advisable to define the expression only once in the form of a **`<macro>`** and replace each occurrence of the given expression with the corresponding macro. Macros use a notation for their placeholder similar to template variables. Macro placeholders are identified by the **`%`** (percent) sign and a pair of enclosing **{}** (brackets). The following example defines a macro named **CriterionStartAngle**.
|
|
|
|
|
|
```xml
|
|
```xml
|
|
<macro identifier="CriterionStartAngle">${CriterionIndex} * (360 / ${NumberOfCriteria})</macro\>
|
|
<macro identifier="CriterionStartAngle">${CriterionIndex} * (360 / ${NumberOfCriteria})</macro>
|
|
```
|
|
```
|
|
|
|
|
|
The macro defines an expression using two templating variables,i.e. **${CriterionIndex}** and **${NumberOfCriteria}**. It is worth mentioning that expressions defined in macros are replaced as is, i.e. they are not pre-evaluated but are instead evaluated *in situ*. You may compare this behaviour to a Find & Replace operation taking place during runtime, replacing every occurrence of the **%{CriterionStartAngle}** placeholder with the content of the corresponding **`<macro>`** tag.
|
|
The macro defines an expression using two templating variables,i.e. **${CriterionIndex}** and **${NumberOfCriteria}**. It is worth mentioning that expressions defined in macros are replaced as is, i.e. they are not pre-evaluated but are instead evaluated *in situ*. You may compare this behaviour to a Find & Replace operation taking place during runtime, replacing every occurrence of the **%{CriterionStartAngle}** placeholder with the content of the corresponding **`<macro>`** tag.
|
... | | ... | |