!define
From STIQ
Contents |
!define
Defines a variable (FitNesse variable) for use within the wiki. See: Using Variables
Arguments
<variable name> - a one-word name for the variable
<value> - any amount of text, enclosed within brackets (or parenthesis).
You can define a variable to represent any amount of text. The text in a variable is never interpreted as wiki markup. It is always raw literal text.
You can define a variable like this: !define myVar {some text}
Or you can define a variable like this: !define anotherVar (more text)
The reason there are two forms is so that you can include braces or parenthesis in your variables.
Examples
Rendered example:
myVariable= This is the text of my variable
Entered as:
- !define myVariable {
- This is the
- text of my
- variable
- }
The variable text can span many lines as shown above.
Variable Usage
I can then use or express the variable in a wiki page like so:
- This is the
- text of my
- variable
You express the value of a variable in code like this: ${myVariable}. This expression is replaced with the value of the variable.
If a variable is expressed on a page, but is not found, then its parent pages are searched in order. If the variable is not found in any ancestor pages, FitNesse will inspect System.properties.
Variable Scope
STIQ allows users to define variables which may be used on the current page or any child page within the hierarchy. The scope of the variable is determined by the placement of its defining page within the hierarchy. If the variable is defined at the highest level of the hierarchy it is treated as a global variable and is available to all pages within the hierarchy. If the variable is defined at a lower level within the hierarchy it is treated as a local variable and is available to the defining page and any of its child pages.
