Omni Systems, Inc.

  

Mif2Go User's Guide, Version 55

  

Valid HTML 4.01!

 

Made with Mif2Go

28 Working with macros > 28.9 Deploying macros and macro variables > 28.9.4 Converting a dictionary-style list to an HTML table > 28.9.4.2 Assembling the pieces


28.9.4.2 Assembling the pieces

To have Mif2Go convert a list that uses a run-in format in FrameMaker (as described in §28.9.4.1 Stating the problem) to an HTML table, you must provide configuration settings and HTML code to meet the following challenges:

Coping with a run-in format

Starting and ending the table

Starting and ending each row

Starting and ending each cell.

Coping with a run-in format

By default, Mif2Go treats run-in paragraph formats more like character formats. This means that macros you want inserted before the List_Term items would be embedded in the start of the List_Defn paragraphs instead (which is what you would want if you were trying to preserve the run-in effect in HTML instead of converting the list to a table). To get macros in the right place around List_Term paragraphs, you would need to set the following option:

[HTMLOptions]

RunInHeads=Normal

See §21.3.2 Converting sidehead and run-in paragraph formats.

A more involved alternative would be to use a conversion template to replace the run-in formats with regular paragraph formats; see §3.4.1 Importing formats from a FrameMaker template.

Starting and ending the table

If your document has only one such dictionary-style list, you could insert Code markers containing macros to provide the <table> and </table> tags; see §29.7 Inserting code or text with markers. However, if your document contains many such lists, instead you would want to use macros that employ the following:

macro variables (see §28.3.1 Creating and invoking macro variables)

<$_if> conditions (see §28.6.4.2 Using conditional expressions).

For example, you could define and initialize a macro variable to keep track of where to start and end the table:

[MacroVariable]

InTable=0

You could start a CodeBefore macro for the run-in List_Term format with:

<$_if ($$InTable==0)><table attr=val ... ><$$InTable=1><$_endif>

This code guarantees that the first List_Term paragraph in the list is preceded by an opening <table> tag, yet subsequent List_Term paragraphs are not, as long as the table is still being generated.

To identify the end of the list, you could assign a CodeBefore macro to any paragraph format that can follow the list (but never appear within the list):

<$_if ($$InTable==1)></table><$$InTable=0><$_endif>

Starting and ending each row

Each row of the table starts with a List_Term paragraph, and ends just before the next List_Term paragraph (or the end of the list); and the beginning and end of a row also mark the beginning of the first cell and end of the second cell, respectively. This means the CodeBefore macro for the List_Term format can provide row and cell tags to start and end each row, as well as start the first cell in the row and end the second cell:

<$_if ($$InTable==0)>

   <table attr=val ... ><$$InTable=1>

<$_else>

   </td></tr>

<$_endif>

<tr><td>

Starting and ending each cell

Each List_Defn paragraph marks the end of a List_Term cell and the beginning of a List_Defn cell (which might also include other paragraph formats following the List_Defn paragraph; see §28.9.4.1 Stating the problem). Therefore, a CodeBefore macro assigned to the List_Defn format can provide tags for the end of the first cell and beginning of the second cell:

</td><td>

Next, see §28.9.4.3 Putting it all together.



28 Working with macros > 28.9 Deploying macros and macro variables > 28.9.4 Converting a dictionary-style list to an HTML table > 28.9.4.2 Assembling the pieces