9 Texinfo::Transformations


9.1 Texinfo::Transformations NAME

Texinfo::Transformations - transformations of Texinfo tree


9.2 Texinfo::Transformations NOTES

The Texinfo Perl module main purpose is to be used in texi2any to convert Texinfo to other formats. There is no promise of API stability.


9.3 Texinfo::Transformations DESCRIPTION

Includes miscellaneous methods such as as insert_nodes_for_sectioning_commands that adds nodes for sectioning commands without nodes and complete_tree_nodes_menus and complete_tree_nodes_missing_menu that completes the node menus based on the sectioning tree.

Methods for copying and modifying the Texinfo tree used for default conversion to output formats are in Texinfo::ManipulateTree.


9.4 Texinfo::Transformations METHODS

No method is exported in the default case.

complete_tree_nodes_menus($tree, $add_section_names_in_entries)

Add menu entries or whole menus for nodes associated with sections, based on the sectioning tree. If the optional $add_section_names_in_entries argument is set, a menu entry name is added using the section name. This function should be called after sectioning_structure.

complete_tree_nodes_missing_menu($document, $use_section_names_in_entries)

Add whole menus for nodes associated with sections and without menu, based on the $document sectioning tree. If the optional $add_section_names_in_entries argument is set, a menu entry name is added using the section name. This function should be called after sectioning_structure.

fill_gaps_in_sectioning($tree, $commands_heading_tree)

This function adds empty @unnumbered and similar commands in a tree to fill gaps in sectioning. This may be used, for example, when converting from a format that can handle gaps in sectioning. $tree is the tree root, which is modified by adding the new sectioning commands.

In the default case, the added sectioning commands headings are empty. It is possible to use instead the $commands_heading_tree Texinfo tree element.

If the sectioning commands are lowered or raised (with @raisesections, @lowersection) the tree may be modified with @raisesections or @lowersection added to some tree elements.

insert_nodes_for_sectioning_commands($document)

Insert nodes for sectioning commands without node in $document tree.

menu_to_simple_menu($menu)
set_menus_to_simple_menu($nodes_list)

menu_to_simple_menu transforms the tree of a menu tree element. set_menus_to_simple_menu calls menu_to_simple_menu for all the menus of the nodes in $nodes_list.

A simple menu has no menu_comment, menu_entry or menu_entry_description container anymore, their content are merged directly in the menu in preformatted container.

Note that this kind of tree is not supported by other codes, so this transformation should be avoided unless one knows exactly what to expect.

protect_hashchar_at_line_beginning($tree, $registrar, $customization_information)

Protect hash (#) character at the beginning of line such that they would not be considered as lines to be processed by the CPP processor. The $registrar and $customization_information arguments are optional. If defined, the $registrar argument should be a Texinfo::Report object in which the errors and warnings encountered while parsing are registered. If defined, $customization_information should give access to customization through get_conf. If both $registrar and $customization_information are defined they are used for error reporting in case an hash character could not be protected because it appeared in a raw formatted environment (@tex, @html...).

$modified_tree = reference_to_arg_in_tree($tree, $document)

Modify $tree by converting reference @-commands to simple text using one of the arguments. This transformation can be used, for example, to remove reference @-command from constructed node names trees, as node names cannot contain reference @-command while there could be some in the tree used in input for the node name tree. The $document argument is optional. If given, the converted reference @-command is removed from the $document internal references list.

A $modified_tree is not systematically returned, if the $tree in argument is not replaced, undef may also be returned.

regenerate_master_menu($document, $use_sections)

Regenerate the $document Top node master menu, replacing the first detailmenu in Top node menus or appending at the end of the Top node menu.

$use_sections is an optional argument. If set, sections associated with nodes are used as labels in the generated master menu.


9.5 Texinfo::Transformations SEE ALSO

Texinfo manual, Texinfo::Parser, Texinfo::ManipulateTree.


9.6 Texinfo::Transformations AUTHOR

Patrice Dumas, <pertusus@free.fr>