Noel
Noel
Overview
Download
Documentation
License

Noel Variable Resolution

Noel variable resolutions (inserting variable values into content) is influenced by template languages, including Velocity and FreeMarker. Variables are inserted into output using the following notation:
$ [ ! ] [ * ][ { ][ a..z, A..Z ][ a..z, A..Z, 0..9, -, _ ][ } ]
Normal notation: $mud-Slinger_9
Silent notation: $!mud-Slinger_9
Required notation: $*mud-Slinger_9
Formal notation: ${mud-Slinger_9}

When resolving regular variables and the indicated variable is undefined, the notation is left untouched. This allows the use of WebMacro variables, FreeMarker variables, perl variables, etc. in with Noel source, rather than having to escape all those dollar signs.

$regularVariable...
${regularVariable}...
     =>      $regularVariable...
${regularVariable}...

When resolving silent variables and the indicated variable is undefined, the notation is discarded. This enables optional, Noel-only variables.

$!silentVariable...
$!{silentVariable}...
     =>      ...
...

Required variables are Noel-only and must be defined. This is effectively the same thing as "<assert requiredVariable>$requiredVariable" I recommend using this notation whenever it is valid, to protect against typos and to provide encapsulation between Noel variables and variable notation being passed forward to the text output.

$*requiredVariable
$*{requiredVariable}
     =>      [assertion failed!]
[assertion failed!]

Variables are resolved literally in both text and tag content. In a future version of Noel, I would like to switch variable resolution within tag content to be more logical in the future. (E.g. now you need to use foo="$bar" and I would prefer foo=$bar) This is one of the main reasons that Noel hasn't hit "version 1.0" yet.

 
home  |  acting  |  blog  |  consulting  |  noel  |  contact
© 2013 Michael McDonald, . All rights reserved.