Special container types are recognized by the converter and can be used to convert a Texinfo tree in a specific context. Those types cannot appear in a regular Texinfo tree. They can be the type directly associated with a text element, or the type of a tree root element.
The types are:
_code
In this container, the conversion is done in a code context See Init File Expansion Contexts: Normal, Preformatted, Code, String, Math.
_converted
In this container, the texts are considered to be already formatted. This is more likely to be relevant as the type of a text element.
_string
In this container, the conversion is done in a string context. See Init File Expansion Contexts: Normal, Preformatted, Code, String, Math.
These contexts are typically used together with converter conversion functions (see Converter Object and Conversion Functions). For example:
my @contents = @{$element->{'contents'}}; push @contents, {'text' => ' <code>HTML</code> text ', 'type' => '_converted'}; my $result = $converter->convert_tree({'type' => '_code', 'contents' => \@contents });
There is no context for plain text, but the conversion to plain
text can be achieved by using the Texinfo::Text
converter
(see (texi2any_internals)Texinfo::Convert::Text). For example,
to convert the Texinfo tree element $element to plain text:
my $plaintext = Texinfo::Convert::Text::convert_to_text($element, Texinfo::Convert::Text::copy_options_for_convert_text($converter, 1));