5.2.5 Adding Text And Global Output Units Directions

Adding new directions is a two step process. First, you should register the direction by calling texinfo_register_text_direction or texinfo_register_global_direction, and then you should set the strings associated to the direction with texinfo_register_direction_string_info.

You add a new text direction by calling texinfo_register_text_direction:

Function: texinfo_register_text_direction ($direction)

$direction is a new direction name. The function registers the $direction as a text direction (see Directions).

For example to add the ‘Home’ text direction, call:

texinfo_register_text_direction('Home');

You should then set the strings associated to the text direction (see Direction Strings) with texinfo_register_direction_string_info. For a text direction, you should at least set the ‘text’ associated string. For example:

texinfo_register_direction_string_info('Home', 'text',
 '<a href="https://myhomepage.example.com/">Home</a>', undef, 'normal');
texinfo_register_direction_string_info('Home', 'text',
 'Home myhomepage.example.com', undef, 'string');

You add a global output unit direction by calling texinfo_register_global_direction. You associate the global output unit direction with a node name Texinfo code by giving the argument. The new direction will link to the output unit associated with the node (see Changing Global Directions Output Units). For example, to add a new global direction ‘Tutorial’ associated to the ‘My First Program@node, call:

texinfo_register_global_direction ('Tutorial', 'My First Program');

You should then set the direction strings associated to the new direction:

texinfo_register_direction_string_info ('Tutorial', 'text', 'Tutorial');
texinfo_register_direction_string_info ('Tutorial', 'button', 'Tuto');
texinfo_register_direction_string_info ('Tutorial', 'accesskey', 't');

The following call adds a global direction without associating a node name:

texinfo_register_global_direction ('Global link');

This allows to specify the direction strings associated to the new direction even if the node name is not yet known. See Setting Global Directions From Document Information, for an example of association to a node name based on the document structure.