10.4.5 Output Units in User Defined Functions

Some information is available only in output units. Finding an output unit and using the information associated with the output unit hash reference keys may be needed in user-defined conversion functions.

Both normal and special output units (see Output Units) can be obtained as output units conversion function arguments (see Output Units Conversion Functions). The current output unit being processed is also available as $converter->current_output_unit() (see Other Dynamic Information). Root command (@node or sectioning command) associated_unit key value points to the associated output unit. Lastly get_element_root_command_element may be used to get the the output unit associated with an element (see get_element_root_command_element).

The following keys of output unit hashes can be interesting:

unit_type

unit for normal output units, special_unit for special units and external_node_unit for external nodes virtual units corresponding to references to external manuals.

unit_command

For normal output units, points to the associated @node or sectioning @-command depending on which of nodes or sectioning commands are the main components of output units. See Output Units. The corresponding sectioning and @node @-command elements have an associated_unit key directly in their hash that points to the associated output unit.

For special units, points to a “virtual” tree element with type special_unit_element associated with the special element, that does not appear in the Texinfo tree but can be used as a target for directions to the special unit. This element has an associated_unit key that points to the associated output unit.

for references to external manuals virtual units, points to the tree element corresponding to the external manual and node label.

unit_contents

Array reference on tree elements associated with the output unit.

unit_filename

The associated file name.

unit_directions

Hash with next and prev for the next and previous output units in document order.

special_unit_variety

The variety of the special output unit. For special units only. See Table 16.1.

see (texi2any_internals)Texinfo::Structuring METHODS for more on document structure information held by output units.