Omni Systems, Inc.

  

Mif2Go User's Guide, Version 55

  

Valid HTML 4.01!

 

Made with Mif2Go

15 Converting to DITA XML > 15.5 Nesting DITA block elements > 15.5.12 Splitting a paragraph into separate DITA elements


15.5.12 Splitting a paragraph into separate DITA elements

Suppose your FrameMaker document uses a paragraph format named Definition. The content of a Definition paragraph consists of a term, followed by a tab character, followed by the definition of the term. And suppose you want to convert these paragraphs to a DITA definition list, with each Definition paragraph divided as follows:

<dlentry>

  <dt>term</dt>

  <dd>definition</dd>

</dlentry>

To specify DITA settings for the paragraph format:

[DITAParaTags]

; Each paragraph stats with a term:

Definition = dt

[DITAFirst]

; Each paragraph becomes a separate dlentry:

Definition = dlentry

The second setting above is required because a DITA <dlentry> element can start with more than one <dt> element; however, in this case, you would want each <dt> to begin a new <dlentry>.

Breaking each paragraph at the tab character requires a Mif2Go macro. The macro requires capturing the content of each Definition paragraph for parsing:

[HTMLParaStyles]

Definition = CodeStore CodeAfter

Mif2Go first surrounds the content of each Definition paragraph with tags as specified in [DITAParaTags], then stores the content in CodeStore variable $$Definition; see §28.3.7.2 Inserting code with the CodeStore property.

The CodeAfter property takes care of placing the result of macro expansion in the output; see §28.9.3 Surrounding or replacing text with code or macros:

[ParaStyleCodeAfter]

Definition = <$DefMacro>

The macro must check the content for a tab character. However, tabs are converted to spaces, because they are not meaningful in XML, so a compare to a tab would always fail; see §21.6.2 Understanding how Mif2Go treats tabs in HTML/XML. Instead, the macro compares to a space:

[DefMacro]

; $$Definition contains "<dt>term def ... </dt>"

<$$term = ($$Definition before " ")>\

<$$defn = (($$Definition after " ") before "</dt>")>\

<$$term></dt>

<dd><$$defn></dd>

This macro works correctly only when there are no terms that contain spaces. If some terms contain spaces, you would have to devise a different method, perhaps applying a character format to each term in FrameMaker.



15 Converting to DITA XML > 15.5 Nesting DITA block elements > 15.5.12 Splitting a paragraph into separate DITA elements