| 59 | ==== TEMPLATE ==== |
| 60 | ===== Syntax: ===== |
| 61 | {{{ |
| 62 | @@@TEMPLATE@@@ |
| 63 | }}} |
| 64 | ===== Description: ===== |
| 65 | This is used as magic. It does not do anything or generate any output. |
| 66 | ===== Parameters: ===== |
| 67 | none. |
| 68 | |
| 69 | ==== run ==== |
| 70 | ===== Syntax: ===== |
| 71 | {{{ |
| 72 | @@@run $func [{put into $outvar|print [as $encoding]|discard}] [with $argvar]... [errorvar $errvar][: $extra]@@@ |
| 73 | }}} |
| 74 | ===== Description: ===== |
| 75 | This command runs a function. A function can be provided by a module (see ''module'' command) or by the host application or any other library currently loaded. |
| 76 | |
| 77 | The function will return a variable. It can be stored (''put into $outvar'') or printed (the default, ''print [[as $encoding'') or simply discarded (''discard''). |
| 78 | |
| 79 | The meaning of $argbar and $extra depends on the function called. |
| 80 | |
| 81 | ===== Parameters: ===== |
| 82 | * ''$func'': This is the function name. It is in form ''namespace''bang''function'' (e.g. `std!uname`). |
| 83 | * ''$outvar'': Thi is the variable to store the result of the function call in. |
| 84 | * ''$encoding'': This is the encoding of the output. |
| 85 | * ''$argvar'': This is an variable passed as argument to the function. |
| 86 | * ''$errvar'': This is the name of the variable to store the error value in case of function failure. If this is not set and the function fails the rendering is stopped and the renderer will return in failure. |
| 87 | * ''$extra'': This is a string literal which is passed to the function. |
| 88 | |
| 89 | ===== Example ===== |
| 90 | {{{ |
| 91 | @@@run std!uname put into uname@@@ |
| 92 | }}} |
| 93 | |
| 94 | ==== var ==== |
| 95 | ===== Syntax: ===== |
| 96 | {{{ |
| 97 | @@@var $var[ as $encoding]@@@ |
| 98 | }}} |
| 99 | ===== Description: ===== |
| 100 | This prints the contents of a variable. If the variable is a structure (array or kv) the structure is printed recursively. |
| 101 | ===== Parameters: ===== |
| 102 | * ''$var'': The variable to print. |
| 103 | * ''$encoding'': The encoding to print the variable in. |
| 104 | |
| 105 | ==== varname ==== |
| 106 | ===== Syntax: ===== |
| 107 | {{{ |
| 108 | @@@varname $var[ as $encoding]@@@ |
| 109 | }}} |
| 110 | ===== Description: ===== |
| 111 | This is the same as the ''var'' command but prints the name of the variable not it's name. This can be useful when walking thru kvs. |
| 112 | ===== Parameters: ===== |
| 113 | See ''var''. |
| 114 | |
| 115 | ==== set ==== |
| 116 | ===== Syntax: ===== |
| 117 | {{{ |
| 118 | @@@set $var [of type $type] [to $val]@@@ |
| 119 | @@@set $var [of type $type]: $val@@@ |
| 120 | }}} |
| 121 | ===== Description: ===== |
| 122 | Set the variable ''$var'' to value ''$val''. |
| 123 | The syntax using the extra argument is used for strings while the syntax with using the ''to'' keyword is used for other types. |
| 124 | ===== Parameters: ===== |
| 125 | * ''$var'': The variable to be set. |
| 126 | * ''$type'': The type of variable. |
| 127 | * ''$val'': The value to set ''$var'' to. |
| 128 | |
| 129 | ==== unset ==== |
| 130 | ===== Syntax: ===== |
| 131 | {{{ |
| 132 | @@@unset $var@@@ |
| 133 | }}} |
| 134 | ===== Description: ===== |
| 135 | Unsets (deletes) a the variable ''$var''. |
| 136 | ===== Parameters: ===== |
| 137 | * ''$var'': The variable to unset. |
| 138 | |
| 139 | ==== comment ==== |
| 140 | ===== Syntax: ===== |
| 141 | {{{ |
| 142 | @@@comment[: $comment]@@@ |
| 143 | }}} |
| 144 | ===== Description: ===== |
| 145 | This is a comment. It will not generate any output. |
| 146 | ===== Parameters: ===== |
| 147 | * ''$comment'': The comment. |
| 148 | |
| 149 | ==== include ==== |
| 150 | ===== Syntax: ===== |
| 151 | {{{ |
| 152 | @@@include [rootvar $rootvar]: $file@@@ |
| 153 | }}} |
| 154 | ===== Description: ===== |
| 155 | This includes another uste template for processing. |
| 156 | ===== Parameters: ===== |
| 157 | * ''$rootvar'': This is the new rootvar for the included file. The rootvar is a kv containing all the visible variables. |
| 158 | * ''$file'': The filename of the file to include. This is opened using DSTR. |
| 159 | |
| 160 | ==== literalinclude ==== |
| 161 | ===== Syntax: ===== |
| 162 | {{{ |
| 163 | @@@literalinclude: $file@@@ |
| 164 | }}} |
| 165 | ===== Description: ===== |
| 166 | This includes a file literally. The content of the file is not processed. |
| 167 | ===== Parameters: ===== |
| 168 | * ''$file'': The filename of the file to include. This is opened using DSTR. |
| 169 | |
| 170 | ==== literal ==== |
| 171 | ===== Syntax: ===== |
| 172 | {{{ |
| 173 | @@@literal: $literal@@@ |
| 174 | @@@literal special $special@@@ |
| 175 | }}} |
| 176 | ===== Description: ===== |
| 177 | This prints a literal string. It is mostly useful within a uste mode block to print constant strings. |
| 178 | ===== Parameters: ===== |
| 179 | * ''$literal'': The string to print. |
| 180 | * ''$special'': A special character to print. Currently supported is "at" ("@") and newline ("\n"). |
| 181 | |
| 182 | ==== at ==== |
| 183 | ===== Syntax: ===== |
| 184 | {{{ |
| 185 | @@@at@@@ |
| 186 | }}} |
| 187 | ===== Description: ===== |
| 188 | This is the same as ''@@@literal special at@@@'' |
| 189 | ===== Parameters: ===== |
| 190 | none. |
| 191 | |
| 192 | ==== module ==== |
| 193 | ===== Syntax: ===== |
| 194 | {{{ |
| 195 | @@@module $mod [with para $para] [type $type]@@@ |
| 196 | }}} |
| 197 | ===== Description: ===== |
| 198 | This lodes a module. A module can provide additional features like functions for ''run'' but also other kind of features. The name of the module is always the same as the namespace for exported functions (see ''run''). |
| 199 | ===== Parameters: ===== |
| 200 | * ''$mod'': Name of the module to load. |
| 201 | * ''$para'': A variable of type kv containing arguments to be passed to the module. |
| 202 | * ''$type'': The type of the module. This is "module" for an uste module or "plugin" for any roardl plugin. |
| 203 | |
| 205 | |
| 206 | ==== ROOT ==== |
| 207 | ===== Syntax: ===== |
| 208 | {{{ |
| 209 | @@@ROOT@@@ |
| 210 | }}} |
| 211 | ===== Description: ===== |
| 212 | This is the root element of each processed file. This command is normally not used in templates. |
| 213 | ===== Parameters: ===== |
| 214 | none. |
| 215 | |
| 216 | ==== foreach ==== |
| 217 | ===== Syntax: ===== |
| 218 | {{{ |
| 219 | @@@foreach $val in $var@@@ |
| 220 | @@@foreach $key $val in $var@@@ |
| 221 | }}} |
| 222 | ===== Description: ===== |
| 223 | This walks thru the array or kv ''$var''. ''$val'' is set to the current element and ''$key'' is set to the (key) name of the the current element. |
| 224 | ===== Parameters: ===== |
| 225 | * ''$val'': The variable to store the current element. |
| 226 | * ''$key'': The variable to store the name of the current element. |
| 227 | * ''$var'': The array or kv to walk thru. |
| 228 | |
| 229 | ===== Example ===== |
| 230 | {{{ |
| 231 | @@@foreach key val in var@@@@@@var key@@@: @@@var val@@@ |
| 232 | @@@end@@@ |
| 233 | }}} |
| 234 | |
| 235 | ==== if ==== |
| 236 | ===== Syntax: ===== |
| 237 | {{{ |
| 238 | @@@if [not] [{true|exists|defined}] $a@@@ |
| 239 | @@@if [not] [case [in]sense] {eq|ne|gt|ge|lt|le|begins|ends} $a $b@@@ |
| 240 | }}} |
| 241 | ===== Description: ===== |
| 242 | Test a variable or compare to variables. |
| 243 | |
| 244 | The first syntax will test ''$a'' to be true, to exist at all or to be defined. |
| 245 | The second syntax will test if ''$a'' is equal, not equal, grater than, greater or equal than, less than, less or equal than, begins with or ends with ''$b''. |
| 246 | |
| 247 | In case floats are compared the equal is ''equal within a range of a maximum error of 0.1%''. |
| 248 | ===== Parameters: ===== |
| 249 | * ''$a'', ''$b'': variables to test or compare. |
| 250 | |
| 251 | ==== for ==== |
| 252 | ===== Syntax: ===== |
| 253 | {{{ |
| 254 | @@@for $var from $start to $end@@@ |
| 255 | }}} |
| 256 | ===== Description: ===== |
| 257 | This runs a block of multiple times. |
| 258 | ===== Parameters: ===== |
| 259 | * ''$var'': The variable to store the current value. |
| 260 | * ''$start'': The value to start at (must be a integer literal). |
| 261 | * ''$end'': The value to end at (must be a integer literal). |
| 262 | |
| 263 | ==== while ==== |
| 264 | ===== Syntax: ===== |
| 265 | To be defined. |
| 266 | ===== Description: ===== |
| 267 | Reserved for future use. |
| 268 | ===== Parameters: ===== |
| 269 | To be defined. |
| 270 | |
| 271 | ==== end ==== |
| 272 | ===== Syntax: ===== |
| 273 | {{{ |
| 274 | @@@end@@@ |
| 275 | }}} |
| 276 | ===== Description: ===== |
| 277 | Ends the current (most inner) block. |
| 278 | ===== Parameters: ===== |
| 279 | none. |
| 280 | |
| 281 | ==== pragma ==== |
| 282 | ===== Syntax: ===== |
| 283 | {{{ |
| 284 | @@@pragma [rootvar $rootvar] [literals $literals] [code $code]@@@ |
| 285 | }}} |
| 286 | ===== Description: ===== |
| 287 | The ''pragma'' command changes settings of the current scope. |
| 288 | ===== Parameters: ===== |
| 289 | * ''$rootvar'': Set the current rootvar. The rootvar is a kv holding all currently visible variables. |
| 290 | * ''$literals'': Set the type of processing literals. Must be "true" or "false". If enabled ("true", default) all literals between commands are print. If set to "false" they are discarded. |
| 291 | * ''$code'': This is the code processing mode. Must be "document" (default) or "uste". See ''Introduction'' for more information. |