ContentsIntroductionHip Commands Using Hip Messages Examples Limits Warnings Support Future |
Variable SubstitutionsHIP supports arbitrary text substitution for named variables. A variable is defined in one of two ways: Once defined, a variable is reference by including a phrase like this in the document where the value is to appear:&&name; (that's 2 &'s a name and a semicolon, exactly. Think of it as an extension to the HTML extended character mechanism.) HIP will attempt to perform a substitution whenever it encounters the &&name; construct, and if the 'name' has been defined, the phrase 'value' is substituted. Of course, name and value in this discussion represent arbitrary stings, not the literals 'name' and 'value'. Indirect references to variable values are also possible using the following form: &&@name; This form will look up the value for 'name' and then use that value as a variable name to look up the substitution value. For example, if a table file contains the following lines:
direct=value
indirect=direct
then the substitution value for '&&@indirect;' will be 'value'.
Keep the following restrictions in mind when using variables.
Variable ScopeVariables defined with these mechanisms have a limited scope. Each level of include file nesting establishes a new set of variables which are discarded when the file ends. In addition to the variables defined within a given level, all definitions from any parent levels are also available. In the case of a definition in a 'name=value' clause in an include or replace command, the variable definition is available within the included file and to any files included from within it. In the case of a table command, the variables are available within the file which contained the table command and any files subsequently included within it. If a variable is redefined in subsequently included files, the redefinition follows these same scope rules, and will revert to its original value when exiting that scope. If a variable is defined more than once within the same level, only the most recent definition is used. |
|
|