Suppose you use autonumbers for headings of the style you see in the DITA2Go User's Guide; and suppose you use an automated system to populate a database with the number and text of each heading, from DITA2Go-generated HTML output. You could use macros and macro variables to capture the numerical value of each autonumber, and perhaps output the number as the name value of a tag, such as <a name=nnn>.
For example, suppose you have three heading format levels. In HTML output these heading formats might look like the following:
13.5 This is a second-level heading
6.2.7 This is a third-level heading
To capture each autonumber as a six-digit number, with a leading zero (as needed) for each level (for example, 060207), you could provide settings and macros such as the following:
[HTMLParaStyles]
Chapter=Split Title CodeStore CodeAfter
Heading1=Split Title CodeStore CodeAfter
Heading2=Split Title CodeStore CodeAfter
[StyleCodeStore]
; Set aside in a macro variable the code generated for each heading:
*=Stored
[ParaStyleCodeAfter]
; Parse the autonumber of each heading format; insert the resulting
; six-digit number as <a name=nnnnnn>, and then output
the stored
; heading itself:
Chapter=<$ParseAnum><a name="<$ChapNum>"><$$Stored></a>
Heading1=<$ParseAnum><a name="<$Hdg1Num>"><$$Stored></a>
Heading2=<$ParseAnum><a name="<$Hdg2Num>"><$$Stored></a>
[ChapNum]
; Chapter number followed by four zeros:
<$$Chap as %0.2d>0000\
[Hdg1Num]
; Chapter number, then Heading1 number, then two zeros:
<$$Chap as %0.2d><$$Hdg1 as %0.2d>00\
[Hdg2Num]
; Chapter number, then Heading1 number, then Heading2 number:
<$$Chap as %0.2d><$$Hdg1 as %0.2d><$$Hdg2 as %0.2d>\
[ParseAnum]
; Pick through the stored code to pull out successive pieces of
; the autonumber, and put them in separate macro variables:
<$$Text = ($$Stored after "<b>")>\
<$$Anum = ($$Text before " ")>\
<$$Chap = ($$Anum before ".")>\
<$$Anum2 = ($$Anum after ".")>\
<$$Hdg1 = ($$Anum2 before ".")>\
<$$Hdg2 = ($$Anum2 after ".")>\
Trailing backslashes in the macro code prevent hard line breaks from going into the HTML output.
As each heading is processed, DITA2Go sets aside the generated HTML code in macro variable $$Stored. DITA2Go parses the stored code as follows, to extract the autonumber:
Back in the individual format settings in [ParaStyleCodeAfter], DITA2Go puts out the start of the <a> tag, and then whichever of the macro variables is needed. Finally, DITA2Go adds the original stored heading itself to the output, and closes the <a> tag.