Web Template Applicator
=======================
Applies HTML template files to source files to produce similarly
formatted HTML pages.
String variables are defined in the source file as follows:
<< Comment line.
>> TITLE
Example of using Web Template Applicator
>> BODYTEXT
This is the body text HTML.
>> LASTUPDATED
3/09/97
Any blank lines previous to a >> line or at the end of the file will be
ignored. Whitespaces at the start or end of a variable name will be
trimmed.
These variables are used in the template file as follows:
This page last updated:
Variable names may be composed of any characters except newlines, < and >
signs. Variable names are not case-sensitive. Putting the "" tags (or your chosen equivalents, see below) into a variable name
is asking for trouble though.
Reserved variables (Fixed):
WTA_VERSION x.x.x
WTA_VERSION_MAJOR x.x
WTA_VERSION_MINOR x
WTA_BUILD XXX
WTA_LOSTTEXT Any text at the start of the source file
which comes before the first >> line.
WTA_SOURCE Source filename (.).
WTA_TEMPLATE Template filename (.).
WTA_FULLSOURCE Full source filename (.).
WTA_FULLTEMPLATE Full template filename (.).
WTA_COMPILETIME Time of compilation HH:MM
WTA_COMPILEDATE Date of compilation Weekday, dd Month, Year
Reserved variables (Can be overridden):
WTA_OPENTAG_0
WTA_CLOSETAG_1 % -->
WTA_CLOSETAG_2 %%
By defining one of these in a source file, you affect the way the template
will be processed. This is so you can use whatever tags you prefer. While
you can have multiple lines in a WTA_OPENTAG_ or WTA_CLOSETAG_ variable, this
is silly, so expect silly results (or crashes). The _2 tags are intended
for use within HTML tags.
Any open tag can be matched with any close tag, so for example
is acceptable.
Open and close tags must be on the same line, so a template such as this
is not allowed:
ILLEGAL EXAMPLE
The open and close tags have been split across two lines,
so the template will be rejected.
Only unmatched open tags cause fatal errors, so you can use tag pairs such
as if you want without your real comments causing problems.
If a tag has not been defined, WTA will give a warning, but the tag will be
left as it is. This allows for cool multiply parsed files. See below for an
example of using this technique to incorporate debug info into files.
No line either the source or the template may be over 255 characters long.
WTA automatically indents multiple line variables to the same position as
the start of the variable, so for well formatted body text, you should put
the variable on a new line, such as this:
which would be rendered as
Every line of the variable
starts in the same column.
You may want to include general information in every file as well as
section-specific information. Due to WTA ignoring tags which it doesn't
know, you can include as many source files as you want, by using the output
from the first source as the template for the second and so on.
Example:
WTA -s Source1.wts -t Template.wtt -o tempout.wtt
WTA -s Source2.wts -t tempout.wtt -o Output.htm
del tempout.wtt
Warning - don't try to use the same file as the input and the output.
It won't be pretty.
You can use this idea to include debug information in all your files.
Create a debug info source file such as:
>> DEBUGINFO
Put in a suitable place in each file (e.g. after the
tag). Apply this to your template file with a line such as:
WTA -s DebugInf.wts -t Template.wtt -o tempout.wtt
The tags in the debug source will be replaced on the next parse, so you can
follow this with:
WTA -s Source.wts -t tempout.wtt -o Output.htm
del tempout.wtt
You will then get updated debug info every time you run this sequence.
As you can see, for anything even vaguely complicated, there are a lot of
calls to WTA. You are strongly advised to create a batchfile to compile
each page.
The compile.bat batch file will compile up to seven source files into a
template in one go. Just use the syntax:
Compile