13 Output Units Conversion Functions

Output units formatting function are setup and used similarly as for tree container types (see Type Tree Element Conversion Functions). The output unit types correspond to the unit_type key values of output unit hashes (see Unit Type).

User defined functions called for the conversion of an output unit are registered with texinfo_register_output_unit_formatting. The user defined function is called after conversion of the content.

Function: texinfo_register_output_unit_formatting ($unit_type, \&handler)

$unit_type is the output unit type. \&handler is the user defined function reference.

The call of the user defined functions is:

Function Reference: $text output_unit_conversion ($converter, $unit_type, \%output_unit, $content)

$converter is a converter object. $unit_type is the output unit type. \%output_unit is the output unit. $content the formatted contents. $content can be undef or the empty string.

The $text returned is the result of the output unit conversion.

To call a conversion function from user defined code, the function reference should first be retrieved using type_conversion:

Function: \&output_unit_conversion = $converter->output_unit_conversion ($unit_type)

$unit_type is the output unit type. Returns the conversion function reference for $unit_type, or ‘undef’ if there is none.

It is possible to have access to the default conversion function reference. The function used is:

Function: \&default_output_unit_conversion = $converter->default_output_unit_conversion ($unit_type)

$unit_type is the output unit type. Returns the default conversion function reference for $unit_type, or ‘undef’ if there is none.

Nomal output units with output unit type unit default conversion involves calling the formatting reference format_element_footer (see Element Header and Footer Formatting).

Special units conversion is achieved by calling special_unit_body_formatting (see Special Unit Body Formatting Functions), format_navigation_header (see Navigation Panel and Navigation Header Formatting), format_heading_text (see Basic Formatting Customization) and format_element_footer (see Element Header and Footer Formatting). Special units type is special_unit.