14.5.10 Splitting a paragraph into separate DITA
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:
Definition = dt
; 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:
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 §18.104.22.168 Using the CodeStore property to insert code.
The CodeAfter property
takes care of placing the result of macro expansion in the output; see
or replacing text with code or macros:
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 §20.5.2 Understanding how Mif2Go treats tabs in HTML/XML.
Instead, the macro compares to a space:
; $$Definition contains "<dt>term def ...
<$$term = ($$Definition before " ")>\
<$$defn = (($$Definition after " ") before
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.
> 14 Producing DITA XML > 14.5 Nesting DITA block elements > 14.5.10 Splitting a paragraph into separate DITA elements