42 Elements Script Template

This chapter provides information about the Dynamic Converter elements script template and code.

This chapter covers the following topics:

42.1 About the Elements Script Template

The Element script template separately defines all the elements of a source file:

  • Standard properties (author, title, subject, keywords, comments).

  • Other properties that might be included by the author of the source file.

  • Sections of the source file.

  • All other properties (footnotes, endnotes, annotations, comments, headers, footers, bookmarks).

The template is not called by any other template, and simply acts to separate all source file elements.

42.2 Elements Script Template Code

Each of the code segments in this section (in bold) is followed by explanatory text.

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset={## INSERT ELEMENT=pragma.charset}">
{## IF ELEMENT=Property.Title}
   <TITLE>{## INSERT ELEMENT=Property.Title}</TITLE>
{## ELSE}
<TITLE>Converted {## INSERT ELEMENT=Pragma.SourceFileName}</TITLE>
{## /IF}

If a title property exists in this document, then insert it into the HTML title. Otherwise, insert the name of the document into the HTML title.

</head>

<body bgcolor="#FFFFFF">
<div align="left">

<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
   <tr>
      <td><font size="7">Dynamic Converter</font><br>
        <font color="#FFFFFF" size="5">Sample Template – All Elements</font>
      </td>
   </tr>
</table>
</div>

Defines the table at the top of the output page, and the text within the table ("Dynamic Converter Sample Template – All Elements"), as well as the font color and size of this text.

<p>&nbsp;</p>
<div align="left">

<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
      <tr>
        <td><font color="#FFFFFF" size="5">Standard Properties</font></td>
      </tr>
</table>
</div>

Defines the second table of the output page.

<p><strong>Author: </strong>
{## INSERT ELEMENT=Property.Author}<br>
<strong>Title: </strong>
{## INSERT ELEMENT=Property.Title}<br>
<strong>Subject: </strong>
{## INSERT ELEMENT=Property.Subject}<br>
<strong>Keywords: </strong>
{## INSERT ELEMENT=Property.Keywords}<br>
<strong>Comment:</strong>
{## INSERT ELEMENT=Property.Comment}</p>

These ## Insert macros insert the source file's respective properties (Author, Title, Subject, Keywords, Comments), as written by the author of the source file being exported.

<div align="left">

<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
   <tr>
      <td><font color="#FFFFFF" size="5">Other Properties</font></td>
   </tr>
</table>
</div>

Defines the third table of the output page.

<p>{## REPEAT ELEMENT=Property.Others}
<strong>
{## INSERT
ELEMENT=Property.Others.Current.Name}: </strong>
{## INSERT ELEMENT=Property.Others.Current.Body}<br>
{## /REPEAT}</p>

Inserts the name and body of the exported source file's other properties, as defined by the author of the source file. The "Name" and "Body" properties are referenced differently than the initial properties (Author, Title, Subject, Keywords, Comments). The author of a source file can create separate properties that do not have the keywords of the initial properties, and the above ## REPEAT macro allows these separate properties to be read. This is achieved by looping through the source file's other, unspecified properties by referencing and outputting both the name and body elements for these unspecified properties.

<p>{## REPEAT ELEMENT=Sections}</p>

A loop on a repeatable element, "Sections" is used to represent the highest level of abstraction within the source file. This repeatable element would allow a loop to be performed on a three-sheet spreadsheet, for example, so that each sheet is shown in the output. It is necessary to loop through sections in order to output each separate part of a section. In general:

  • Word processor documents will have only one section, that being the document itself.

  • Spreadsheets will have one section for each sheet or chart.

  • Presentations have one section for each slide.

  • Graphics, in most cases, have only one section, but many have multiple sections, such as a multi-page TIFF. For convenience and readability, "Sheets" and "Slides" are synonymous with "Sections" in Dynamic Converter.

<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
    <td><font color="#FFFFFF" size="5">Section
{## INSERT NUMBER=Sections.Current.Value}
The fourth table of the output page is defined and the index value that is inserted into the table is incremented once through each loop.

{## IF ELEMENT=Sections.Current.Type VALUE=WP}
- Document
{## ELSE}
{## IF ELEMENT=Sections.Current.Title} - {## INSERT ELEMENT=Sections.Current.Title
      SUPPRESSTAGS}
{## /IF}

{## /IF}

</font>
</td>

The template determines if the source file is word processing (WP) and:

  • If the source file is word processing, "Document" is placed in the output table following "Section" and the index value.

  • If the source file is not word processing, the template will check for the title of the source file and place that title in the output. Finally, tags that might be present within the source file are suppressed from the output of the source file. This suppression is done to strip HTML tags that Dynamic Converter adds in order to duplicate the source file's original font. This is done in situations where either

    • Plain text is appropriate, or

    • The template author wishes to control the appearance of the output text.

</tr>
</table>
</div>

<p>
{## INSERT ELEMENT=Sections.Current.BodyOrImage}</p>

This macro line allows the template author to account for any document type. See Sections.x.BodyOrImage in the "Elements" section.

<p>
{## IF ELEMENT=Sections.Current.Type VALUE=WP}
</p>
<p>
{## IF ELEMENT=Sections.Current.Footnotes.1.Body}
</p>
<div align="left">
<table border="0" cellpadding="2"width="600" bgcolor="#8080FF">
<tr>
  <td><font color="#FFFFFF" size="5">Footnotes</font>
</td>
</tr>
</table>

The template first determines if the section type is word processing and then if there are footnotes included with this section. If footnotes are included, a table is defined that introduces "Footnotes."

</div>
<p>
{## REPEAT ELEMENT=Sections.Current.Footnotes}
{## INSERT ELEMENT=Sections.Current.Footnotes.Current.Body}
<br>
{## /REPEAT}
{## ELSE}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">No Footnotes</font></td>
</tr>
</table>
</div>
<p>
{## /IF}

</p>

A repeatable element outputs all footnotes associated with the current section. If there are no footnotes associated with the current section, a table is created indicating "No Footnotes."

The rest of the HTML coding for this template concerns elements that are similar in their coding to the recently described "Footnotes" repeatable element. For example, for the next repeatable element "Endnotes," the coding acts to present the endnotes in the source file output in the same way as that for the footnotes:

  • The template determines if there are endnotes included in the current section.

  • If endnotes are included, a table is defined that introduces "Endnotes."

A repeatable element outputs all endnotes associated with the section.

  • If there are no endnotes associated with the section, a table is created indicating "No Endnotes."

The following HTML coding and resulting output will follow the same procedure for annotations, comments, headers, footers and bookmarks.

<p>
{## IF ELEMENT=Sections.Current.Endnotes.1.Body}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">Endnotes</font></td>
</tr>
</table>
</div>
<p>
{## REPEAT ELEMENT=Sections.Current.Endnotes}
{## INSERT ELEMENT=Sections.Current.Endnotes.Current.Body}<br>
{## /REPEAT}

{## ELSE}
</p>
<div align="left"><table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF"
size="5">No Endnotes</font></td>
</tr>
</table>
</div>
<p>
{## /IF}

</p>
<p>
{## IF ELEMENT=Sections.Current.Annotations.1.Body}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
    <td><fontcolor="#FFFFFF" size="5">Annotations</font></td>
</tr>
</table>
</div>
<p>
{## REPEAT ELEMENT=Sections.Current.Annotations}
   {## INSERT ELEMENT=Sections.Current.Annotations.Current.
Body}<br>
{## /REPEAT}

{## ELSE}
</p>
   <div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">No Annotations</font></td>
</tr>
</table>
</div>
<p>
{## /IF}

</p>
<p>

{## IFELEMENT=Sections.Current.Headers.1.Body}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">Headers</font></td>
</tr>
</table>
</div>
<p>
{## REPEAT ELEMENT=Sections.Current.Headers}
{## INSERT ELEMENT=Sections.Current.Headers.Current.Body} <br>
    {## /REP}

{## ELSE}
</p>
<div align="left"><table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">No Headers</font></td>
</tr>
</table>
</div>
<p>
{## /IF}

</p>
<p>
{## IF ELEMENT=Sections.Current.Footers.1.Body}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">Footers</font></td>
</tr>
</table>
</div>
<p>
{## REPEAT ELEMENT=Sections.Current.Footers}
{## INSERT ELEMENT=Sections.Current.Footers.
Current. Body}<br>
{## /REP}

{## ELSE}
</p>
<div align="left">
<table border="0" cellpadding="2" width="600" bgcolor="#8080FF">
<tr>
<td><font color="#FFFFFF" size="5">No Footers</font></td>
</tr>
</table>
</div>
<p>
{## /IF}

</p>
<p>
{## /IF}

</p>
<p>
{## /REPEAT}

</p>
</body>
</html>