Creating HTML |
Top Previous Next |
Creating HTML
UnForm will create HTML output if you specify "-p html" on the command line. Given this parameter, and with no "-f rulefile" parameter, UnForm will look for the "html.rul" file rather than the default "unform.rul" file used for printer output.
By default, the HTML output is generated to standard output (on UNIX only), but it is normally preferable to specify an output file, such as "-o /usr/internet/docs/reports/aging". UnForm can then build the reports with varying styles in stages, and a browser can view interim results as soon as the first page is generated. UnForm will add a ".htm" extension automatically to the output file. UnForm will also create additional files depending on the style of the report. For example, if a table of contents is generated as a separate document, then the base file (aging.htm in the above example) will be the table of contents, and additional files will be generated for the pages of the report (aging.page.htm).
A sample command, therefore, might look like this:
unform -i aging.txt -o /usr/internet/docs/reports/aging -p html -f ourhtml.rul As HTML structure is very different from that of laser printers PCL, HTML rule sets are very different from printer rule sets. UnForm uses HTML table structures to format pages. These structures have a defined hierarchy of rows, cells, and data, with attributes applied to either cells or data. HTML rule sets follow this structure in that you define rows, then within rows you define cells, and then within cells you define the attributes of the cell and text.
The HTML output that UnForm produces can be in one of several styles. The rule set options used to trigger the style are shown in parentheses:
*The simplest form is that of one document with all the pages sequentially created as tables. If no output file is specified (-o filename), this is what UnForm will produce regardless of any style options you specify. *The output can be produced in one file, with a table of contents at the top of the file (toc=y or toc=l, multipage=n). As each page is generated and appended to the file, the table of contents is updated and inserted at the top. The table of contents consists of descriptions linked to the individual pages. The descriptions default to "Page number n", but can be created in page code blocks. Additionally, the table of contents can be created as a vertical column (toc=y), or as a bullet list (toc=l). *The output can be produced in multiple files (multipage=y), with the table of contents being the primary one, with links to each page as a separate HTML document. *The output can be produced as frames (frame=y), with the table of contents in one frame, and pages in the other. The target pages can be stored in a single file, multi-page document, or with each page in an individual file.
Note that all these options but the first require that a table of contents be maintained as each page is generated. In order to construct an updated document as each page is generated, UnForm must generate temporary files with which to build the HTML required. The filename specified by the "-o" option is re-created as each page is completed. Therefore, if standard output is generated rather than output files, only the first style can be produced.
This interim generation of files means that the HTML output can be viewed as soon as the first page is generated. This can be very helpful when large reports are being formatted in real-time. |