In the default formatting, when a sectioning command is encountered, a
<div>
element is opened for the extent of the sectioning command
including its children sectioning commands. This extent need to be closed
at different places, for instance when another sectioning command
is reached, at the end of a file, or at the end of the document.
The user defined formatting function should take care of registering and closing opened section levels. In the default code, registering is done in the sectioning commands conversion function only.
The function for registering opened section extent is
register_opened_section_level
:
$level is the sectioning command level. It is typically
obtained with section->{'structure'}->{'section_level'}
(see Texinfo Tree Elements in User Defined Functions).
$closing_text is the text that should be output when the
section level $level is closed.
The function for closing registered section extents is
close_registered_sections_level
:
@closing_texts =
$converter->close_registered_sections_level ($level)
¶$level is the sectioning command level. Opened section are closed down to section level $level. The closing texts are returned in the @closing_texts array in order.
Example of use:
my $level = $opening_section->{'structure'}->{'section_level'}; $result .= join('', $converter->close_registered_sections_level($level)); $converter->register_opened_section_level($level, "</div>\n");