HTML Slider Token Replacement, Part 2

Replacement "directives" can also be inserted into the template to direct the token replacement engine to do more complicated things than simple text replacement. For example:


[#ifdef Title]

<title>The Title is [Title].</title>



#MakePage Example.html MyTemplate

In the above "MyTemplate", a token replacement directive is specified as "[#ifdef Title]". If the token "Title" exists at the time when the #MakePage directive is found, then the title tags are included in the output. Otherwise they are not.

There are three repacement directives. These are:

[#ifdef name]Conditional to include following text if the token is defined (exists).
[#ifndef name]Conditional to include following text if the token is not defined (does not exist)
[#endif]Ends the conditional.

In each of the above, "name" is the name of a token to test for. The token exists (is defined) if either a local token or a global token with "name" exists at the time a directive is encountered. Currently there is no way to delete a global token, so once you define a global, it always exists. Therefore, these replacement directives are mainly intended to be used with local tokens.

You can nest the #ifdef/#endif and #ifndef/#endif pairs as deep as you like.

With these token replacement directives, you can construct complicated templates, and have more control over the ultimate output.