About Macros Units: { UNIT}, { HEADER}, and { FOOTER}

7-12 Administrators Guide for Dynamic Converter

7.3.2 Creating a Set of HTML Files for Each Slide in a Presentation

The following example uses a single script template file and the { LINK...} macro to create a set of HTML files, one for each slide in a presentation. The { LINK...} does the dual job of driving the generation of the HTML files and providing a next link for navigation. Notice the use of the Next keyword in the { IF...} macro that checks to see if there is a next slide. html body -- Insert the current slide -- { INSERT ELEMENT=Slides.Current.Image WIDTH=300} hr -- Is there a next slide? -- { IF ELEMENT=Slides.Next.Image} -- If yes, generate a URL to an HTML file containing the next slide. The HTML file is generated using the current template because there is no TEMPLATE attribute. While generating the new HTML file, the value of the index on Slides is its current value plus 1 once control returns to this template, the value of the index on Slides is unchanged. -- pa href={ LINK ELEMENT=Slides.Next.Image}Nextap { ELSE} -- If no, create a link to the HTML containing the first slide. -- pa href={ LINK ELEMENT=Slides.1.Image}Firstap { IF} body html

7.4 Macros

This section covers the following topics: ■ About Macros on page 7-12 ■ Units: { UNIT}, { HEADER}, and { FOOTER} on page 7-13 ■ Insert Element: { INSERT} on page 7-14 ■ Conditional: { IF...}, { ELSEIF...}, and { ELSE} on page 7-18 ■ Loop: { REPEAT} on page 7-19 ■ Linking With Structured Breaking: { LINK} on page 7-20 ■ Linking With Content Size Breaking: { ANCHOR} on page 7-23 ■ Comment Put in the Output File: { IGNORE} on page 7-24 ■ Comment Not Put in the Output File: { COMMENT} on page 7-24 ■ Including Other Templates: { INCLUDE} on page 7-25 ■ Setting Options Within the Template: { OPTION} on page 7-25 ■ Copying Files: { COPY} on page 7-28 ■ Deprecated Template Macros on page 7-29

7.4.1 About Macros

Macros are commands to Dynamic Converter within script templates. Despite their casual similarity to HTML tags, they are not bound by any of the rules that tags would Script Templates 7-13 usually follow inside an HTML file. Macros may appear anywhere in the script template file, except inside another macro. In the documentation and examples, the pieces of a macro are always shown delimited by spaces. However, semicolons may also delimit them. This option was added to accommodate certain HTML editors. In certain editors, URLs entered into dialog boxes may not have non-quoted spaces. This made it difficult or impossible to use the { LINK} macro in these situations. For example, { INSERT ELEMENT=Sections.1.Body} may also be written as {;INSERT;ELEMENT=Sections.1.Body}. Note that template macro string parameters and options support sprintf style escaped characters. This means that characters such as \x22, \r and are supported. Also note that most template attribute values may be quoted. The exception is template element strings, which may not be quoted at this time. For example: { ANCHOR aref=next format=a href=\url\Nextabr\r\n}

7.4.2 Units: { UNIT}, { HEADER}, and { FOOTER}

If a template file is going to make use of the { UNIT} macro at all, this macro must be the first macro in the template file. It delimits the beginning and end of each unit. Unit boundaries are used when determining where to break the document when breaking based on content size see Breaking Documents by Content Size on page 7-46. A unit consists of a header, a footer both of which are optional, and a body which 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. Syntax { UNIT [BREAK]} [{ HEADER} any HTML { HEADER}] any HTML [{ FOOTER} any HTML { FOOTER}] { UNIT} Attributes BREAK 7-14 Administrators Guide for Dynamic Converter

7.4.3 Insert Element: { INSERT}