Script Templates 7-47
everything that is left between the header and the footer. The { UNIT} macro must be the first macro in the template. The body frequently contains nested units. The body
may be empty.
To ensure that the header is the first item in the template and the footer is the last item, text between the { UNIT} tag and the { HEADER} tag will be ignored, as will text
between the { FOOTER} tag and the { UNIT} tag, including whitespace. The header and footer of a unit will be output in every page containing that unit, enclosing
that portion of the units body that is able to fit in a particular page. The entire template is a unit that may contain additional units.
7.9.1 A Sample Size Breaking Template
By way of example, lets take another look at the very simple template from About
Script Templates . To make things more interesting, lets insert the character set into the
template with a meta tag. Lets also insert some better navigation to improve movement between the pages. The modified version of the template is as follows:
{ unit}{ header} htmlhead
meta HTTP-EQUIV=Content-Type CONTENT=texthtml; charset={ insert element=pragma.charset} head
body { anchor aref=prev format=pa href=\url\Prevap}
{ header} pHere is the document you requested.
{ insert element=property.title}
by
{ insert element=property.author}
p pBelow is the document itselfp
{ insert element=body} { footer}
{ anchor aref=next format=pa href=\url\Nextap} body
html { footer}{ unit}
A very small value about 20 characters is used for the page size option. The resulting HTML might look like this HTML that is the result of a macro is in bold:
file1.htm htmlhead
meta HTTP-EQUIV=Content-Type CONTENT=texthtml; charset=us-ASCIIhead body
pHere is the document you requested.p pA Poem by Phil Boutrosp
pa href=file2.htmNextap body
html
file2.htm htmlhead
meta HTTP-EQUIV=Content-Type CONTENT=texthtml; charset=us-ASCII head body
pa href=file1.htmNextap pBelow is the document itselfp
pRoses are redp pViolets are bluep
7-48 Administrators Guide for Dynamic Converter
pa href=file3.htmPrevap body
html
file3.htm htmlhead
meta HTTP-EQUIV=Content-Type CONTENT=texthtml; charset=us-ASCII head body
pa href=file2.htmPrevap pIm a programmerp
pand so are youp body
html
There are several things to note here:
■
The page size option value does not apply to the text from the template, only the text inserted from the source document. Each page contains roughly 20 characters
of visible input document text.
■
The { INSERT} of the character set is part of the { HEADER} and therefore is inserted into all the output pages.
■
Text from the body of the unit is inserted sequentially. Thus as is template text such as the line pBelow is the document itselfp is only inserted once.
■
The { ANCHOR} tags only insert links to the previousnext page if there actually is a previousnext page. Thus the first page does not have a link to the
non-existent previous page.
7.9.2 Templates Without { UNIT} Macros