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:
To specify DITA settings for the paragraph format:
; Each paragraph stats with a term:
; Each paragraph becomes a separate 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:
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:
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:
; $$Definition contains "<dt>term def ... </dt>"
<$$term = ($$Definition before " ")>\
<$$defn = (($$Definition after " ") before "</dt>")>\
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