Next: Texinfo::Commands , Up: (dir) [Contents][Index]
Next: Texinfo::CommandsValues , Previous: Texinfo modules documentation , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Commands SYNOPSIS , Up: Texinfo::Commands [Contents][Index]
Texinfo::Commands - Classification of commands
Next: Texinfo::Commands NOTES , Previous: Texinfo::Commands NAME , Up: Texinfo::Commands [Contents][Index]
use Texinfo::Commands;
if ($Texinfo::Commands::accent_commands{$a_command}) {
print STDERR "$a_command is an accent command\n";
}
Next: Texinfo::Commands DESCRIPTION , Previous: Texinfo::Commands SYNOPSIS , Up: Texinfo::Commands [Contents][Index]
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.
Next: @-COMMAND INFORMATION , Previous: Texinfo::Commands NOTES , Up: Texinfo::Commands [Contents][Index]
Texinfo::Commands holds a few hashes with information on @-commands and hashes classifying Texinfo @-commands.
Next: @-COMMAND CLASSES , Previous: Texinfo::Commands DESCRIPTION , Up: Texinfo::Commands [Contents][Index]
Hashes are defined as our variables, and are therefore available
outside of the module.
Hash describing the default Texinfo indices. The format of this hash is
described in Texinfo::Document::indices_information.
Next: Texinfo::Commands SEE ALSO , Previous: @-COMMAND INFORMATION , Up: Texinfo::Commands [Contents][Index]
Hashes are defined as our variables, and are therefore available
outside of the module.
The key of the hashes are @-command names without the @. The following hashes are available:
Accent @-commands taking an argument, like @' or @ringaccent,
including @dotless and @tieaccent.
Commands delimiting a block with a closing @end. The values are:
@if* commands;
Definition commands like @deffn;
@float;
raw output format commands such as @html or @info;
commands with @item containing
any content, @itemize and @enumerate;
commands like @table in which the @item argument is on its line;
menu @-commands, @menu, @detailmenu
and @direntry;
Math block commands, like @displaymath.
@multitable;
The remaining block commands.
Commands whose content should not be filled, like @example or @display.
Commands like @quotation.
@-commands that have no expansion
of @-commands in their bodies (@macro, @verbatim and @ignore);
Commands delimiting a region of the document out of the main processing:
@titlepage, @copying, @documentdescription.
Block commands containing @item with possible content before an @item,
like @itemize, @table or @multitable.
Brace commands that have their argument in code style, like
@code.
The commands that take braces. Value is noarg for brace commands without
argument such as @AA, @TeX, or @equiv. Other values include
accent, arguments, context and other values.
Commands that stop a paragraph. Root commands are not specified here, but they also close paragraphs.
Set to the number of arguments separated by commas that may appear in braces or
on the @-command line. That means 0 or unset for most block commands,
including @example which has an unlimited (variadic) number of arguments, 1
for @quotation, 2 for @float, 1 for most brace commands, 2 for @email
and @abbr, 5 for @image and @ref.
Values are not necessarily set for all the commands, as commands are also classified by type of command, some type of commands implying a number of arguments, and the number of arguments may not be set if it corresponds to the default (0 for block commands, 1 for other commands that take arguments).
Commands containing simple text only, much like paragraph text, but
without @ref, @footnote, @titlefont, @anchor nor @verb.
Commands accepting only plain text with accent, symbol and glyph commands.
Definition commands.
Index entry commands corresponding to default indices. For example
@cindex.
@-commands whose second argument explain first argument and further
@-command call without first argument, as @abbr and @acronym.
Line commands which may be formatted as text, but that require constructing
some replacement text, for example @printindex, @need or
@verbatiminclude. @contents and @shortcontents are not in this hash,
since they are in a corresponding situation only when the tables of contents
are formatted where the commands are.
Commands not taking brace formatted as text or with text in the main
document body, corresponding to symbol commands such as @@ or @: and
commands such as @item. @-commands appearing only in headers are not
in this hash, but in in %in_heading_spec_commands.
Line commands which arguments may be formatted as text, such as
@center, @author, @item, @node, @chapter and other.
Index commands may be formatted as text too, but they may be added
with @def*index, therefore they are not in that hash. Also,
in general, they are not formatted as text where they appear, only
when an index is printed.
@-commands used to specify custom headings, like @everyheading.
Special @-commands appearing in custom headings, such as @thischapter,
@thistitle or @|.
@-commands only valid in index entries, such as @sortas or @subentry.
Inline conditional commands, like @inlineifclear, and inline format
commands like @inlineraw and @inlinefmt.
@-commands with braces but no argument corresponding to letters,
like @AA{} or @ss{} or @o{}.
@-commands which contains math, like @math or @displaymath.
Commands that do not take braces, take arguments on the command line and are
not block commands either, like @node, @chapter, @cindex, @deffnx,
@end, @footnotestyle, @set, @settitle, @itemx,
@definfoenclose, @comment and many others.
Note that @item is in %line_commands for its role in @table and
similar @-commands.
Commands that do not start a paragraph.
Command that do not take braces, do not have argument on their line and
are not block commands either. The value is symbol for single character
non-alphabetical @-commands such as @@, @ or @:. Other commands in that hash
include @indent, @tab or @thissection.
Note that @item is in %nobrace_commands for its role in @multitable,
@itemize and @enumerate.
Block commands not formatted as text, such as @ignore or @macro.
Brace commands that are not immediately replaced with text, such as
anchor, caption, errormsg and others.
@-commands that do not stop the preamble.
%preformatted_commands is for commands whose content should not
be filled, like @example or @display. If the command is meant
for code, it is also in %preformatted_code_commands, like @example.
Cross reference @-command referencing nodes, like @xref or @link.
Commands that are at the root of a Texinfo document, namely
@node and sectioning commands, except heading commands
like @heading.
All the sectioning and heading commands.
Commands with unlimited arguments, like @example.
Next: Texinfo::Commands AUTHOR , Previous: @-COMMAND CLASSES , Up: Texinfo::Commands [Contents][Index]
Next: Texinfo::Commands COPYRIGHT AND LICENSE , Previous: Texinfo::Commands SEE ALSO , Up: Texinfo::Commands [Contents][Index]
Patrice Dumas, <pertusus@free.fr>
Previous: Texinfo::Commands AUTHOR , Up: Texinfo::Commands [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Common , Previous: Texinfo::Commands , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::CommandsValues SYNOPSIS , Up: Texinfo::CommandsValues [Contents][Index]
Texinfo::CommandsValues - Associations of information to Texinfo @-commands
Next: Texinfo::CommandsValues NOTES , Previous: Texinfo::CommandsValues NAME , Up: Texinfo::CommandsValues [Contents][Index]
use Texinfo::CommandsValues;
my $command_text = $Texinfo::CommandsValues::nobrace_symbol_text{'@'};
Next: Texinfo::CommandsValues DESCRIPTION , Previous: Texinfo::CommandsValues SYNOPSIS , Up: Texinfo::CommandsValues [Contents][Index]
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.
Next: @-COMMAND ASSOCIATED INFORMATION , Previous: Texinfo::CommandsValues NOTES , Up: Texinfo::CommandsValues [Contents][Index]
Texinfo::CommandsValues holds hashes with information on @-commands. Only hashes relevant for conversion of @-commands are documented.
Next: Texinfo::CommandsValues SEE ALSO , Previous: Texinfo::CommandsValues DESCRIPTION , Up: Texinfo::CommandsValues [Contents][Index]
Hashes are defined as our variables, and are therefore available
outside of the module.
Values are ASCII representation of single character non-alphabetical commands
without brace such as * or :. The value may be an empty string.
Values are ASCII representation of commands with empty braces such as
atchar, LaTeX, arrow, quoteleft or AA.
Keys are Texinfo accent commands, such as ' or ogonek. Values are
strings of hexadecimal numbers representing the Unicode codepoint of the
diacritic associated to the accent command. A diacritic is a zero-length
character that should be combined with adjacent characters to have the whole
interpreted as an accented character.
Next: Texinfo::CommandsValues AUTHOR , Previous: @-COMMAND ASSOCIATED INFORMATION , Up: Texinfo::CommandsValues [Contents][Index]
Texinfo::Commands. Texinfo::Convert::Unicode.
Next: Texinfo::CommandsValues COPYRIGHT AND LICENSE , Previous: Texinfo::CommandsValues SEE ALSO , Up: Texinfo::CommandsValues [Contents][Index]
Patrice Dumas, <pertusus@free.fr>
Previous: Texinfo::CommandsValues AUTHOR , Up: Texinfo::CommandsValues [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Parser , Previous: Texinfo::CommandsValues , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Common SYNOPSIS , Up: Texinfo::Common [Contents][Index]
Texinfo::Common - Texinfo modules common data and miscellaneous methods
Next: Texinfo::Common NOTES , Previous: Texinfo::Common NAME , Up: Texinfo::Common [Contents][Index]
use Texinfo::Common;
my @commands_to_collect = ('math');
my $collected_commands
= Texinfo::Common::collect_commands_in_tree($document_root,
\@commands_to_collect);
my $package_version
= Texinfo::Common::get_build_constant('PACKAGE_AND_VERSION');
Next: Texinfo::Common DESCRIPTION , Previous: Texinfo::Common SYNOPSIS , Up: Texinfo::Common [Contents][Index]
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.
Next: MISC INFORMATION , Previous: Texinfo::Common NOTES , Up: Texinfo::Common [Contents][Index]
Texinfo::Common holds hashes with miscellaneous information and some hashes with information on Texinfo @-commands, as well as miscellaneous methods.
Next: @-COMMAND INFORMATION , Previous: Texinfo::Common DESCRIPTION , Up: Texinfo::Common [Contents][Index]
Values defined for a Texinfo build independently of any document or
output format are available by calling get_build_constant:
The following build constants are available:
Texinfo package name and versions. Values of build constants without
_CONFIG appended are set by configure. For each variable set by
configure there is another one with _CONFIG appended
to the name set to the same value, to match the name of the macros set in
C. So, for example PACKAGE_VERSION_CONFIG value is the same as
PACKAGE_VERSION, set to the PACKAGE_VERSION value set by configure.
Hashes are defined as our variables, and are therefore available
outside of the module.
Keys are customization options corresponding to @-commands. For example
frenchspacing or footnotestyle.
Keys are null devices names, such as /dev/null or NUL.
Cannonical output formats that have associated conditionals. In
practice corresponds to format_raw %block_commands plus info
and plaintext.
Next: Texinfo::Common METHODS , Previous: MISC INFORMATION , Up: Texinfo::Common [Contents][Index]
Hashes are defined as our variables, and are therefore available
outside of the module.
The key of the hashes are @-command names without the @. The following hashes are available:
All the @-commands.
%def_aliases associates an aliased command to the original command, for
example defun is associated to deffn.
%def_no_var_arg_commands associates a definition command name with
a true value if the argument on the definition command line can contain
non-metasyntactic variables. For instance, it is true for deftypevr
but false for defun, since @defun argument is supposed to contain
metasyntactic variables only.
Associate small command like smallexample to the regular command
example.
Next: Texinfo::Common SEE ALSO , Previous: @-COMMAND INFORMATION , Up: Texinfo::Common [Contents][Index]
Two methods are exported in the default case for Texinfo modules messages
translation in the Uniforum gettext framework, __ and __p.
The Texinfo tree and Texinfo tree elements used in argument of some functions
are documented in TEXINFO TREE. When customization
information is needed, an object that defines set_conf and/or get_conf is
expected, for example a converter inheriting from
Texinfo::Convert::Converter, see Getting and setting customization variables.
Returns the $msgid string translated in the Texinfo messages text domain.
__p can be used instead of __ to pass a $msgctxt context string to
provide translators with information on the string context when the string is
short or if the translation could depend on the context. __ corresponds to
the gettext function and __p to the pgettext function.
It is not advised to use those functions in user-defined code. It is not
practical either, as the translatable strings marked by __ or __p need to
be collected and added to the Texinfo messages domain. This facility could
only be used in user-defined code with translatable strings already present in
the domain anyway. In fact, these functions are documented mainly because they
are automatically exported.
See Locale::Messages,
gettext C interface,
Perl in GNU Gettext.
For translation of strings in output, see Texinfo::Translations.
Returns a hash reference with keys @-commands names specified in the $commands_list array reference and values arrays of tree elements corresponding to those @-command found in $tree by traversing the tree.
Return a list reference containing the tree elements corresponding to the @-commands names specified in the $commands_list found in $tree by traversing the tree. The order of the @-commands should be kept.
Returns the encoding name that can be used for decoding derived from the encoding that was set where $element appeared.
Return true if the element passed in argument is in running text context. If the optional $check_current argument is set, check the element itself, in addition to the parent context.
Encode the $file_name text string to a binary string $encoded_file_name
based on $input_encoding. Also returns the $encoding name actually
used which may have undergone some normalization. This function is mostly
a wrapper around Encode Encode::encode which avoids calling the module if not
needed. Do nothing if $input_encoding is undef.
This function returns the number or letter correponding to item
number $number for an @enumerate specification $specification,
appearing on an @enumerate line. For example
enumerate_item_representation('c', 3)
is e.
$element should be an accent command Texinfo tree element. Returns
an element containing the innermost accent @-command contents,
normally a text element with one or two letter, and an array reference
containing the accent commands nested in $element (including
$element). If there is no argument at all for the accent command,
$contents_element is undef.
Find the parent root command (sectioning command or node) of a tree element.
The $object argument is optional, its global_commands field is used
to continue through @insertcopying if in a @copying.
Return a Texinfo tree element corresponding to the content of the index
entry associated to $element. If $prefer_reference_element is set,
prefer an untranslated element. If the element is an index command like
@cindex or an @ftable @item, the content element is the argument
of the command. If the element is a definition line, the index entry
element is based on the name and class.
Returns the encoding assumed for input file names. $name_encoding is used as encoding name if defined. If $doc_encoding_for_input_file_name is set, the encoding is based on the input file content encoding, otherwise $locale_encoding is used. The $document argument is an optional Texinfo parsed document used to get the input document content encoding. The $input_file_encoding argument is optional, it will be used in priority if the the encoding is based on the input file encoding. If $input_file_encoding is not given, it is recommended to pass $document, otherwise there is no way to determine the input document content encoding.
Return true if the $tree has content that could be formatted. $do_not_ignore_index_entries is optional. If set, index entries are considered to be formatted.
Locate $file_path. If $file_path is an absolute path or has .
or .. in the path directories it is checked that the path exists and is a
file. Otherwise, the file name in $file_path is located in include
directories also used to find texinfo files included in Texinfo documents.
$file_path should be a binary string. undef is returned if the file was
not found, otherwise the file found is returned as a binary string.
Returns an $index_entry hash based on the $index_entry_info and
$indices_information. Also returns the $index_info hash with information on
the index associated to the index entry. $index_entry_info should be
an array reference with an index name as first element and the index entry number
in that index (1-based) as second element. In general, the $index_entry_info
is an extra index_entry associated to an element.
The $index_entry hash is described in Texinfo::Document index_entries. The
$index_info hash is described in Texinfo::Document::indices_information.
Normalize the node name string given in argument, by normalizing Top node case.
Remove first occurence of $element in the array reference $array.
If the optional $replacement argument is given, replace the $element
by $replacement. Return the removed element, or undef if not found.
Return numbered level of the tree sectioning element $section, as modified by raise/lowersections.
Set the Texinfo customization variable corresponding to $cmdname in $customization_information. The $global_commands_information should contain information about global commands in a Texinfo document, typically obtained from a parsed document $document->global_commands_information(). $command_location specifies where in the document the value should be taken from, for commands that may appear more than once. The possibilities are:
Set to the last value for the command.
Set sequentially to the values in the Texinfo preamble.
Set to the first value of the command if the first command is not in the Texinfo preamble, else set as with preamble, sequentially to the values in the Texinfo preamble.
The $element returned is the last element that was used to set the
customization value, or undef if no customization value was found.
Notice that the only effect of this function is to set a customization variable value, no @-command side effects are run, no associated customization variables are set.
Set the Texinfo customization option corresponding to the tree element
$element. The command associated to the tree element should be
a command that sets some information, such as @documentlanguage,
@contents or @footnotestyle for example. Return true if the command
argument was found and the customization variable was set.
If not already set, set OUTPUT_ENCODING_NAME based on input file
encoding.
Split the $element contents at @| in at max three parts.
Return an element containing the split parts in contents, or undef if
the $element has no useful content. The input $element
is supposed to be the argument line element of
%Texinfo::Commands::heading_spec_commands commands such as @everyheading.
Return true if the $name is a known customization option.
Return true if the $name is a known tree transformation name
that may be passed with TREE_TRANSFORMATIONS to modify a Texinfo
tree.
Next: Texinfo::Common AUTHOR , Previous: Texinfo::Common METHODS , Up: Texinfo::Common [Contents][Index]
Texinfo::Parser, Texinfo::Convert::Converter and Texinfo::Report.
Next: Texinfo::Common COPYRIGHT AND LICENSE , Previous: Texinfo::Common SEE ALSO , Up: Texinfo::Common [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Common AUTHOR , Up: Texinfo::Common [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Document , Previous: Texinfo::Common , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Parser SYNOPSIS , Up: Texinfo::Parser [Contents][Index]
Texinfo::Parser - Parse Texinfo code into a Perl tree
Next: Texinfo::Parser NOTES , Previous: Texinfo::Parser NAME , Up: Texinfo::Parser [Contents][Index]
use Texinfo::Parser;
my $parser = Texinfo::Parser::parser();
my $document = $parser->parse_texi_file("somefile.texi");
my $errors = $document->parser_errors();
foreach my $error_message (@$errors) {
warn $error_message->{'error_line'};
}
Next: Texinfo::Parser DESCRIPTION , Previous: Texinfo::Parser SYNOPSIS , Up: Texinfo::Parser [Contents][Index]
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.
Next: Texinfo::Parser METHODS , Previous: Texinfo::Parser NOTES , Up: Texinfo::Parser [Contents][Index]
Texinfo::Parser will parse Texinfo text into a Perl tree. In one pass
it expands user-defined @-commands, conditionals (@ifset, @ifinfo...)
and @value and constructs the tree. Some extra information is gathered
while doing the tree: for example the number of columns in a multitable,
or the node associated with a section.
Next: TEXINFO TREE , Previous: Texinfo::Parser DESCRIPTION , Up: Texinfo::Parser [Contents][Index]
No method is exported in the default case. The module allows both an object-oriented syntax, or traditional function, with the parser as an opaque data structure given as an argument to every function.
Next: Parsing Texinfo text , Up: Texinfo::Parser METHODS [Contents][Index]
The following method is used to construct a new Texinfo::Parser object:
This method creates a new parser. The options may be provided as a hash reference. Most of those options correspond to Texinfo customization options described in the Texinfo manual.
Handle cpp like synchronization lines if set. Set in the default case.
An array reference of the output formats for which @ifFORMAT
conditional blocks should be expanded. Default is empty.
Possible values are nomenu, menu, menu_no_detailmenu and
sectiontoc. Only report menu-related errors for menu and
menu_no_detailmenu.
An array reference of directories in which @include files should be
searched for. Default contains the working directory, ..
If set, spaces after an @-command name that take braces are ignored. Default on.
Maximal number of nested user-defined macro calls. Default is 100000.
A string corresponding to a document language set by @documentlanguage.
It overrides the document @documentlanguage information, if present.
A hash reference. Keys are names, values are the corresponding values.
Same as values set by @set.
Previous: Initialization , Up: Texinfo::Parser METHODS [Contents][Index]
Different methods may be called to parse some Texinfo code:
parse_texi_line for a line, parse_texi_piece for a fragment of
Texinfo, parse_texi_text for a string corresponding to a full document
and parse_texi_file for a file. The first argument of these functions
is a parser.
When parse_texi_line is used, the resulting tree is rooted at
a root_line type container. Otherwise, the resulting tree should be
rooted at a document_root type container.
This function is used to parse a short fragment of Texinfo code.
$text is the string containing the texinfo line. $first_line_number is the line number of the line, if undef, it will be set to 1.
This function is used to parse Texinfo fragments.
$text is the string containing the texinfo text. $first_line_number is the line number of the first text line, if undef, it will be set to 1.
This function is used to parse a text as a whole document.
$text is the string containing the texinfo text. $first_line_number is the line number of the first text line, if undef, it will be set to 1.
The file with name $file_name is considered to be a Texinfo file and is parsed into a tree. $file_name should be a binary string.
The errors collected during the tree parsing are available with
the resulting document parser_errors.
This function returns the $error_warnings_list as an array of hash references one for each error, warning or error line continuation. They are described in detail in Texinfo::Report::count_errors.
Next: Texinfo::Parser SEE ALSO , Previous: Texinfo::Parser METHODS , Up: Texinfo::Parser [Contents][Index]
A Texinfo tree element (called element because node is overloaded in
the Texinfo world) is an hash reference. There are three main categories
of tree element. Tree elements associated with an @-command have a
cmdname key holding the @-command name. Tree elements corresponding
to text fragments have a text key holding the corresponding text.
Finally, the last category is other elements, which in most cases have
a type key holding their name. Text fragments and @-command elements
may also have an associated type when such information is needed.
The contents key holds an array reference for the children of @-command
tree elements and containers. In particular for arguments of an @-command,
either in braces or on the rest of the line after the command, depending on
the type of command. Also for content appearing within a block @-command,
within a container, or within a @node or sectioning @-command. Text
fragments do not have children.
The extra and info keys are associated to hash references and hold
information gathered during the parsing.
info key extra key Next: Element keys , Up: TEXINFO TREE [Contents][Index]
Next: Line command tree element , Up: Texinfo tree structure [Contents][Index]
A full Texinfo tree is rooted at a document_root type element.
document_root first element in contents should be a
before_node_section container for content appearing before the first node or
sectioning command. Nodes and sections @-commands elements follow. The node
or sectioning command elements contents hold all the elements corresponding
to Texinfo code before the next node or sectioning command element or @bye.
If present in the Texinfo document, the @bye element is next. If there is
content after @bye, it is last in the postamble_after_end container
element.
The content of before_node_section depend on the presence of
@setfilename in the document before the first node or sectioning element:
@setfilenameThe first container in before_node_section is
preamble_before_setfilename. The first element in
preamble_before_setfilename is preamble_before_beginning, which
holds everything appearing before the first content, including
the \input texinfo.tex line and following blank lines. It may be
followed by paragraphs and block commands elements, if any, although it is
not recommended to have such content before @setfilename.
The second container in before_node_section is
preamble_before_content, which begins with @setfilename
and contains everything appearing before the first formatted content,
corresponding to the preamble in the Texinfo documentation.
The paragraphs and other contents follow up in before_node_section
contents until the first node or section.
@setfilenameThe first container in before_node_section is preamble_before_beginning, which holds everything appearing before the first content, including the \input texinfo.tex line and following blank lines.
It is followed by preamble_before_content, which contains everything appearing before the first formatted content, corresponding to the preamble in the Texinfo documentation.
The paragraphs and other contents follow up in before_node_section
contents until the first node or section.
preamble_before_content contains empty lines text elements,
elements corresponding to line commands such as @documentlanguage or
@frenchspacing, block commands such as @copying that are not immediately
output but also raw output block commands such as @html.
The first element of a node or sectioning command contents
is an arguments_line container holding the command arguments
appearing on the @-command line. The arguments_line in turn contains
line_arg containers for each of the node arguments separated by
commas, or the unique sectioning command argument. The node or
sectioning command contents follow, including paragraphs, empty line
text elements, all kind of block commands and line commands such as
@center or index commands such as @cindex as well as @image
command elements out of paragraphs.
Next: Block command tree element , Previous: Root and first level elements , Up: Texinfo tree structure [Contents][Index]
There are three main types of line commands, regular line commands, lineraw line commands and definition line commands. All the line commands hold line_arg containers for their arguments.
lineraw line commands arguments are not subject to the
usual macro expansion. lineraw line commands with
arguments are, for example, @set, @unmacro
and @comment. @raisesections, @contents and @novalidate
are examples of lineraw line commands without arguments.
They only have one line_arg container, which should only contain
one rawline_text text element.
Most line commands with arguments that are not node or sectioning commands are
regular line commands. Regular line command contents holds line_arg
containers for each of the line arguments separated by commas. line_arg
containers contain in turn text elements, elements of @-commands without
arguments, with empty braces, such as @equiv and with braces such as
@code or @ref.
Definition line commands elements are elements associated to commands like
@deffnx or @defline. They contain a line_arg container, which, in
turn contains the specific definition line containers such as def_category,
def_arg and some special text elements such as space.
Next: Paragraphs and preformatted , Previous: Line command tree element , Up: Texinfo tree structure [Contents][Index]
The first element of block command contents is an arguments_line
container holding the command arguments appearing on the @-command line,
similar to node and sectioning command elements. The arguments_line holds
block_line_arg containers for each of the arguments separated by commas,
similar to line commands. Definition block commands such as @deffn do not
follow the same rule and do not have an arguments_line container.
@defblock command element, however, is like regular block commands, with an
arguments_line container as first contents element.
The remaining elements in contents depend on the block command. Block
commands like @float, @quotation or @flushleft remaining contents
are paragraphs, empty line text elements, line commands and nested block
commands, much like node and sectioning elements, appearing before the matching
@end commmand element.
Block commands like @example or @display are similar except that they
contain preformatted containers instead of paragraphs and so do
other block commands nested in those @-commands.
Other block commands contain specific containers depending on the block
command. Block commands with @item may contain a before_item container
for contents before the first @item. @itemize and @enumerate block
commands following contents are @item commands holding the Texinfo
code elements until the next @item or @end. @table and similar block
commands elements in contents are table_entry containers for each table
line, that contain themselves specific containers. @multitable contains
multitable_head and multitable_body containers. @menu contents
hold menu_entry and menu_comments container elements.
The definition commands such as @deffn contain a def_line container
as first contents, may contain an inter_def_item container, also contains
@deffnx line commands, and ends with a def_item container for the main
contents of the definition command. The @defblock commands contents may
hold a before_defline element after the line arguments, also contains
line @-commands such as @defline and a def_item container. The
def_line container contains a block_line_arg container,
which, in turn contains the specific definition line containers such as
def_category, def_arg and some special text elements such as space.
Raw block commands such as @verbatim, @ignore or @macro
contain directly raw text elements.
Lastly, raw output commands such as @html element in contents after the
arguments_line is either an elided_rawpreformatted element container
containing raw text elements if ignored, or a rawpreformatted container
containing directly text and @-command elements if output.
The @end command element is a regular line command element and is the last
element of all the block commands contents.
Next: Brace commands , Previous: Block command tree element , Up: Texinfo tree structure [Contents][Index]
paragraph and preformatted container contents are
text elements, elements of @-commands without arguments, such as @}, with
empty braces, such as @equiv and with braces such as @code or @ref.
They may also contain elements corresponding to the few line commands that do
not stop a paragraph, such as index command elements. preformatted
container may contain empty line text elements, while paragraph containers
do not.
Next: Texinfo line tree , Previous: Paragraphs and preformatted , Up: Texinfo tree structure [Contents][Index]
@footnote and @caption @-command elements that start a new context and
contain paragraphs and block commands contain a brace_command_context
container. The brace_command_context container contains paragraph,
line command and block command elements, much like node, sectioning and block
command elements. @math also contains a brace_command_context container,
which contains directly text and brace commands more similar to the
preformatted container.
For commands taking arguments surrounded by braces when the whole text in the
braces is in the argument, such as @u or @code the first and only
contents element is a brace_container.
Other brace commands, in particular brace commands with arguments separated
by commas contain brace_arg containers, one for each of the arguments.
The brace_container and brace_arg containers contain directly text
elements some @-commands without arguments and other @-commands with braces,
similar to line_arg or paragraph containers.
Next: Showing the tree structure , Previous: Brace commands , Up: Texinfo tree structure [Contents][Index]
When parsing Texinfo line fragments using parse_texi_line, a root_line
type element is the root element. It should typically contain elements
that appear in paragraph, preformatted or containers like line_arg.
Previous: Texinfo line tree , Up: Texinfo tree structure [Contents][Index]
You can see examples of the tree structure by running makeinfo like this:
makeinfo -c DUMP_TREE=1 -c TEXINFO_OUTPUT_FORMAT=parse document.texi
For a simpler, more regular representation of the tree structure, you can do:
makeinfo -c TEXINFO_OUTPUT_FORMAT=debugtree document.texi
Next: Element types , Previous: Texinfo tree structure , Up: TEXINFO TREE [Contents][Index]
The command name of @-command and user-defined macro call elements.
The text fragment of text elements.
The type of element considered, in general a container. Frequent types encountered are paragraph for a paragraph container, brace_container for the container holding a brace @-commands content, line_arg and block_line_arg contain the arguments appearing on the line of @-commands. Text fragments may have a type to give an information of the kind of text fragment, for example spaces_before_paragraph is associated to spaces appearing before a paragraph beginning. Most @-commands elements do not have a type associated.
An array reference holding the list of children of the element.
The parent element. Not set for text elements.
An hash reference corresponding to information on the location of the element in the Texinfo input manual. It should mainly be available for @-command elements, and only for @-commands that are considered to be complex enough that the location in the document is needed, for example to prepare an error message.
The keys of the line number hash references are
The line number of the @-command.
The file name where @-command appeared.
The user macro name the @-command is expanded from.
A hash reference holding any other information that cannot be
obtained otherwise from the tree.
See Information available in the info key.
A hash reference holding information that could also be obtained
from the tree, but is directly associated to the element to simplify
downstream code.
See Information available in the extra key.
Next: Information available in the info key , Previous: Element keys , Up: TEXINFO TREE [Contents][Index]
Next: Types for text elements , Up: Element types [Contents][Index]
Some types can be associated with @-commands (in addition to cmdname),
although usually there will be no type at all. The following are the possible
values of type for tree elements for @-commands and user-defined macro call
elements.
This type is set for an @-command that is redefined by @definfoenclose.
The beginning is in {'extra'}->{'begin'} and the end in
{'extra'}->{'end'}.
This is the type of index entry command like @cindex, and, more
importantly user-defined index entry commands. So for example if there
is:
@defindex foo ... @fooindex index entry
the @fooindex @-command element will have the index_entry_command
type.
Container holding the arguments of user-defined macro, linemacro or rmacro. It should not appear directly in the tree as the user defined call is expanded. The macro_call_line or rmacro_call_line elements are used when there are no braces and the whole line is the argument.
Next: Tree container elements , Previous: Types for command and user-defined macro call elements , Up: Element types [Contents][Index]
The text elements may have the following types (or may have no type at all):
Space after a node in the menu entry, when there is no description, and space appearing after the description line.
Spaces on definition command line separating the definition command arguments. Delimiters, such as comma, square brackets and parentheses appearing in definition command line arguments at the end of the line, separated from surrounding texts during the parsing phase.
An empty line (possibly containing whitespace characters only).
Spaces appearing after an @-command without braces that does not
take argument on the line, but which is followed by ignorable
spaces, such as @item in @itemize or @multitable, or @noindent.
Spaces appearing before an @-command that are ignorable. For example
spaces appearing before a @subentry on an index command line.
Text of the argument of a user defined linemacro call in bracket. It does not contain the braces. It should not appear directly in the tree as the user defined linemacro call is replaced by the linemacro body.
Macro call arguments texts. Linemacro call arguments when the arguments are not bracketed. These elements should not appear directly in the tree, as the macro calls are replaced by the expansion of the macro bodies.
Text appearing on a @macro, @linemacro or @rmacro line after
the @-command, including the leading space and the newline. In the
arguments_line container @-command.
Text elements that are not in the Texinfo tree elements. It could be part of informative out of tree elements, added for separators or used for other specific purposes.
Spaces appearing after a closing brace, for some rare commands for which
this space should be ignorable (like @caption or @sortas).
Spaces after @-command arguments before a comma, a closing brace or at end of line. Not directly in the tree.
Spaces following an @-command before that argument (for accent commands) or before the opening brace. Not directly in the tree.
Spaces following the opening brace of some @-commands with braces and bracketed content type, spaces following @-commands for line commands and block command taking Texinfo as argument, and spaces following comma delimited arguments. Not directly in the tree.
Space appearing before a paragraph beginning.
Text in an environment where it should be kept as is (in @verbatim,
@verb, @macro body).
Used for the text in arguments to some special line commands whose arguments
aren’t subject to the usual macro expansion. For example @set,
@unmacro, @comment.
Space within an index @-command before an @-command interrupting the index command, when there are only spaces after the interrupting @-command.
Text appearing after @bye.
Text appearing before real content, including the \input texinfo.tex.
English text added by the parser that may need to be translated during conversion. Happens for definition line @-commands aliases that leads to prepending text such as “Function”.
Next: Types of container elements , Previous: Types for text elements , Up: Element types [Contents][Index]
Some types of element are containers of portions of the tree,
either for the whole tree, or for contents appearing before @node
and sectioning commands.
Content before nodes and sectioning commands at the beginning of
document_root.
root_line is the type of the root tree when parsing Texinfo line
fragments using parse_texi_line. document_root is the document
root otherwise.
document_root first content should be before_node_section, then nodes and
sections @-commands elements, @bye element and postamble_after_end.
This container holds everything appearing after @bye.
This container holds everything appearing before the first content, including
the \input texinfo.tex line and following blank lines.
This container holds everything that appears before @setfilename.
This container holds everything appearing before the first formatted content, corresponding to the preamble in the Texinfo documentation.
Previous: Tree container elements , Up: Element types [Contents][Index]
The other types of element are containers with other elements appearing in
their contents. The paragraph container holds normal text from the
Texinfo manual outside of any @-commands, and within @-commands with blocks of
text (@footnote, @itemize @item, @quotation for example). The
preformatted container holds the content appearing in @-commands like
@example and the rawpreformatted container holds the content appearing in
format commands such as @html. The other containers are more specific.
The types of container element are the following:
Special type containing balanced braces content (braces included)
in the context where they are valid, and where balanced braces need to
be collected to know when a top-level brace command is closed. In @math,
in raw output format brace commands and within brace @-commands in raw output
format block commands.
A container for content before the first @defline or @deftypeline
in @defblock.
A container for content before the first @item of block @-commands
with items (@table, @multitable, @enumerate...).
Those containers occur within the contents array of @-commands taking an
argument. brace_container is used for the argument to commands
taking arguments surrounded by braces when the whole text in the braces
is in the argument. brace_arg is used for the arguments to commands taking
arguments surrounded by braces when the leading and, in most cases, trailing
spaces are not part of the argument, and for arguments in braces separated by
commas. brace_command_context is used for @-commands with braces that start
a new context (@footnote, @caption, @math).
line_arg is used for commands that take the texinfo code on the rest of the
line as their argument, such as @settitle, or for @node, @section
arguments_line container. block_line_arg is similar but is used for
arguments_line container of commands that start a new block (which is to be
ended with @end).
following_arg is used for the accent @-commands argument that did not use braces but instead followed the @-command, possibly after a space, as
@~n @ringaccent A
For example
@code{in code}
leads to
{'cmdname' => 'code',
'contents' => [{'type' => 'brace_container',
'contents' => [{'text' => 'in code'}]}]}
Bracketed argument. On definition command and on @multitable line.
Definition line arguments containers corresponding to the different parts of a
definition line command. Contains one bracketed_arg, def_line_arg or
untranslated_def_line_arg container.
The def_line type is associated with a container within a block definition
command. It holds the definition line arguments in block_line_arg.
A @def* @-command line command such as @deffnx or @defline
also holds the definition line arguments, in line_arg.
The type of each definition line arguments element describes the meaning of the
element. It is one of def_category, def_name, def_class, def_type,
def_arg, def_typearg, spaces or delimiter, depending on the
definition.
The container with type def_item holds the definition text content. Content appearing before a definition command with a x form is in an inter_def_item container.
the def_line_arg contains one or several elements that together are a single unit on a definition command line. This container is very similar with a bracketed_arg on a definition line, except that there is no bracket. Appears in definition line arguments containers such as def_category, def_arg or similar.
The untranslated_def_line_arg is similar, but only happens for automatically
added categories and contains only a text element. For example, the deffun
line def_category container may contain an untranslated_def_line_arg type
container containing itself a text element with “Function” as text, if the
document language demands a translation. Note that the
untranslated_def_line_arg is special, as, in general, it should not be
recursed into, as the text within is untranslated, but the untranslated text
should be gathered when converting the untranslated_def_line_arg type
container.
The menu_comment container holds what is between menu entries in menus. For example, in:
@menu Menu title * entry:: Between entries * other:: @end menu
Both
Menu title
and
Between entries
will be in a menu_comment.
A menu_entry holds a full menu entry, like
* node:: description.
The different elements of the menu entry are in the
menu_entry contents array reference.
menu_entry_leading_text holds the star and following spaces.
menu_entry_name is the menu entry name (if present), menu_entry_node
corresponds to the node in the menu entry, menu_entry_separator holds
the text after the node and before the description, in most cases
:: . Lastly, menu_entry_description is for the description.
In @multitable, a multitable_head container contains all the rows
with @headitem, while multitable_body contains the rows associated
with @item. A row container contains the @item and @tab
forming a row.
A paragraph. The contents of a paragraph (like other container
elements for Texinfo content) are elements representing the contents of
the paragraph in the order they occur, such as text elements
without a cmdname or type, or @-command elements for commands
appearing in the paragraph.
Texinfo code within a format that is not filled. Happens within some
block commands like @example, but also in menu (in menu descriptions,
menu comments...).
Texinfo code within raw output format block commands such as @tex
or @html.
Those containers appear in @table, @ftable and @vtable.
A table_entry container contains an entire row of the table.
It contains a table_term container, which holds all the @item and
@itemx lines. This is followed by a table_definition container, which
holds the content that is to go into the second column of the table.
If there is any content before an @itemx (normally only comments,
empty lines or maybe index entries are allowed), it will be in
a container with type inter_item at the same level of @item
and @itemx, in a table_term.
Next: Information available in the extra key , Previous: Element types , Up: TEXINFO TREE [Contents][Index]
info key ¶ @verb delimiter is in delimiter.
Set if the element is not in the Texinfo input code, but is inserted
as a default for @-command argument or as a definition command automatically
inserted category (for example Function for @defun).
A reference to an element containing the spaces after @-command arguments before a comma, a closing brace or at end of line, for some @-commands and bracketed content type with opening brace, and line commands and block command lines taking Texinfo as argument and comma delimited arguments. Depending on the @-command, the spaces_after_argument is associated with the @-command element, or with each argument element.
For accent commands with spaces following the @-command, like:
@ringaccent A @^ u
there is a spaces_after_cmd_before_arg key linking to an element containing the spaces appearing after the command in text.
Space between a brace @-command name and its opening brace also ends up in spaces_after_cmd_before_arg. It is not recommended to leave space between an @-command name and its opening brace.
A reference to an element containing the spaces following the opening brace of some @-commands with braces and bracketed content type, spaces following @-commands for line commands and block command taking Texinfo as argument, and spaces following comma delimited arguments. For context brace commands, line commands and block commands, spaces_before_argument is associated with the @-command element, for other brace commands and for spaces after comma, it is associated with each argument element.
Previous: Information available in the info key , Up: TEXINFO TREE [Contents][Index]
extra key ¶
Next: Extra keys specific of certain @-commands or containers , Up: Information available in the extra key [Contents][Index]
Normalized argument of @documentencoding. For @documentencoding
itself, and also for @-command arguments that name a file, which could make
use of the document encoding at the localtion they are defined.
The node element identifier in the parsed tree containing the element. Set for @-commands elements that have an associated index entry.
The region command (@copying, @titlepage) containing the element,
if it is in such an environement. Set for @-commands elements that have an
associated index entry and for @anchor.
The index entry information is associated to @-commands that have an associated
index entry. The associated information should not be directly accessed,
instead Texinfo::Common::lookup_index_entry
should be called on the extra index_entry value:
my ($index_entry, $index_info)
= Texinfo::Common::lookup_index_entry(
$element->{'extra'}->{'index_entry'},
$indices_information);
The $indices_information is the information on a Texinfo manual indices
obtained from
Texinfo::Document::indices_information.
The index entry information hash returned by
Texinfo::Common::lookup_index_entry is described in
Texinfo::Document index_entries.
Currently, the index_entry value is an array reference with an index name as first element and the index entry number in that index (1-based) as second element.
A string containing the characters flagged as ignored in key sorting in the document by setting flags such as txiindexbackslashignore. Set, if not empty, for @-commands elements that have an associated index entry.
An array holding strings, the arguments of @-commands taking simple
textual arguments as arguments, like @everyheadingmarks,
@frenchspacing, @alias, @synindex, @columnfractions.
The string correspond to the line after the @-command for @-commands
that have an argument interpreted as simple text, like @setfilename,
@end or @documentencoding.
Previous: Extra keys available for more than one @-command , Up: Information available in the extra key [Contents][Index]
@abbr@acronymThe first argument normalized is in normalized.
@anchor@float@-commands that are targets for cross-references have a normalized key for the normalized label, built as specified in the Texinfo documentation in the HTML Xref node. There is also a node_content key for an element holding the corresponding content.
def_linedef_command holds the line definition command name, without x if the line
definition command is an x form of a block definition command. For a
def_line container, def_command holds the command name associated
with the def_line. original_def_cmdname is the original def command
name.
If the element is a definition line command and is an x form of a block definition command, it has not_after_command set if not appearing after the block definition command without x.
The def_index_element is a Texinfo tree element corresponding to
the index entry associated to the definition line, based on the
name and class. If needed this element is based on translated strings.
In that case, if @documentlanguage is defined where the element
is located, documentlanguage holds the documentlanguage value.
def_index_ref_element is similar, but not translated, and only set if
there could have been a translation.
The omit_def_name_space key value is set and true if the Texinfo variable
txidefnamenospace was set, signaling that the space between function
definition name and arguments should be omitted.
@definfoenclose defined commandsbegin holds the string beginning the @definfoenclose,
end holds the string ending the @definfoenclose.
@float@listoffloatsIf @float has a first argument, and for @listoffloats argument there
is a float_type key with the normalized float type.
@subentryIf an index entry @-command, such as @cindex, or a @subentry contains
a @sortas command, sortas holds the @sortas command content
formatted as plain text.
@inlinefmt@inlineraw@inlinefmtifelse@inlineifclear@inlineifsetThe first argument is in format. If an argument has been determined
as being expanded by the Parser, the index of this argument is in
expand_index. Index numbering begins at 0, but the first argument is
always the format or flag name, so, if set, it should be 1 or 2 for
@inlinefmtifelse, and 1 for other commands.
@item in @enumerate or @itemizeThe item_number extra key holds the number of this item.
@item and @tab in @multitableThe cell_number index key holds the index of the column of the cell.
@table@vtable@ftableIf the command in argument for @table, @vtable or @ftable
is @kbd and the context and @kbdinputstyle is such that @kbd
should be formatted as code, the command_as_argument_kbd_code
extra key is set to 1.
@kbdcode is set depending on the context and @kbdinputstyle.
@macromacro_name holds the macro name.
invalid_syntax is set if there was an error on the @macro
line.
menu_entry_nodeExtra keys with information about the node entry label same as those
appearing in the @node line_arg explicit directions arguments
extra hash labels information.
@multitableThe key max_columns holds the maximal number of columns.
@nodeNode name and explicit directions labels information are available
as line_arg tree element arguments of the @node line.
Each line_arg argument element extra hash node_content key value is an
element holding the contents corresponding to the node name. There is also a
manual_content key if there is an associated external manual name, and a
normalized key for the normalized label, built as specified in the HTML
Xref Texinfo documentation node.
The first node containing a @printindex @-command has the isindex
key set.
paragraphThe indent or noindent key value is set if the corresponding @-commands are associated with that paragraph.
@ref@xref@pxref@inforefThe brace_arg corresponding to the node argument holds information on
the label, with the same information in the extra hash as for the
@node line_arg explicit directions arguments.
rowThe row_number index key holds the index of the row in
the @multitable.
If the level of the document was modified by @raisections
or @lowersections, the differential level is in level_modifier.
The section level, taking into account @raisections and
@lowersections is in section_level. Level 0 corresponds to @top
or @part and level 1 to @chapter.
The sectioning command formatted number is in section_heading_number.
This information is only present if the sectioning structure has been
determined by Texinfo::Structuring::sectioning_structure.
untranslated_def_line_argdocumentlanguage holds the @documentlanguage value.
If there is a translation context, it should be in translation_context.
Next: Texinfo::Parser AUTHOR , Previous: TEXINFO TREE , Up: Texinfo::Parser [Contents][Index]
Next: Texinfo::Parser COPYRIGHT AND LICENSE , Previous: Texinfo::Parser SEE ALSO , Up: Texinfo::Parser [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Parser AUTHOR , Up: Texinfo::Parser [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::ManipulateTree , Previous: Texinfo::Parser , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Document SYNOPSIS , Up: Texinfo::Document [Contents][Index]
Texinfo::Document - Texinfo document tree and information
Next: Texinfo::Document NOTES , Previous: Texinfo::Document NAME , Up: Texinfo::Document [Contents][Index]
use Texinfo::Parser;
my $parser = Texinfo::Parser::parser();
my $document = $parser->parse_texi_file("somefile.texi");
my $indices_information = $document->indices_information();
my $float_types_arrays = $document->floats_information();
my $internal_references_array
= $document->internal_references_information();
# $identifier_target is an hash reference on normalized
# node/float/anchor/namedanchor names.
my $identifier_target = $document->labels_information();
# A hash reference, keys are @-command names, value is the
# corresponding @-commands tree element or an
# array reference holding all the corresponding @-commands.
# Also contains dircategory and direntry list.
my $global_commands_information
= $document->global_commands_information();
# a hash reference on document information (encodings,
# input file name, for example).
my $global_information = $document->global_information();
Next: Texinfo::Document DESCRIPTION , Previous: Texinfo::Document SYNOPSIS , Up: Texinfo::Document [Contents][Index]
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.
Next: Texinfo::Document METHODS , Previous: Texinfo::Document NOTES , Up: Texinfo::Document [Contents][Index]
This module is used to represent parsed Texinfo documents, with the Texinfo tree and associated information. A document is always obtained from a Texinfo parser method call as the result of parsing a Texinfo text or file.
For example, the $document obtained in the following example is a
Texinfo::Document object:
my $parser = Texinfo::Parser::parser();
my $document = $parser->parse_texi_file("somefile.texi");
Next: Texinfo::Document SEE ALSO , Previous: Texinfo::Document DESCRIPTION , Up: Texinfo::Document [Contents][Index]
Next: Merging and sorting indexes , Up: Texinfo::Document METHODS [Contents][Index]
The main purpose of Texinfo::Document methods is to retrieve information on a Texinfo document.
The Texinfo tree obtained by parsing a Texinfo document is available through
tree:
The $tree is a hash reference. It is described in TEXINFO TREE.
If $handler_only is set and XS extensions are used, the returned tree holds a reference to the C Texinfo tree data only, but no actual Perl Texinfo tree elements. This avoids building the Perl tree if all the functions called with the tree as argument have XS interfaces, directly use the C data and do not need the Perl tree.
Some global information is available through global_information:
The $info returned is a hash reference. The possible keys are
An array of included file paths as they appear in the document. Binary
strings. From both @include and @verbatiminclude.
input_encoding_name string is the encoding name used for the
Texinfo code.
The name of the main Texinfo input file and the associated directory.
Binary strings. In texi2any, they should come from the command line
(and can be decoded with the encoding in the customization variable
COMMAND_LINE_ENCODING).
If the global information changed, global_information should be called
to update the hash returned by previous calls before accessing the hash again.
Some command lists are available, such that it is possible to go through
the corresponding tree elements without walking the tree. They are
available through global_commands_information:
$commands is an hash reference. The keys are @-command names. For @-commands that may appear multiple time in the Texinfo document, the associated values are array references containing all the corresponding tree elements. For @-commands that should appear only once, the associated value is the tree element.
The following list of commands is also available as a key:
An array of successive @dircategory and @direntry as they appear
in the document.
All the @-commands that have an associated label (so can be the
target of cross references) -- @node, @anchor, @namedanchor
and @float with label -- have a normalized name associated, constructed as
described in the HTML Xref node in the Texinfo documentation. Those
normalized labels and the association with @-commands is available through
labels_information:
$identifier_target is a hash reference whose keys are normalized labels, and the associated value is the corresponding @-command.
$labels_list is a list of Texinfo tree command elements that could be the target of cross references.
Information on @float grouped by type of floats, each type corresponding
to potential @listoffloats is available through floats_information.
$float_types is a hash reference whose keys are normalized float
types (the first float argument, or the @listoffloats argument).
The normalization is the same as for the first step of node names
normalization. The value is a list of array references, one per float
of that type. The first item of the float array reference is the
float tree element. The second item of the float array reference
is the section relations information of the section containing the float.
Internal references, nodes and section information may also be available.
The function returns an array reference of cross-reference commands referring to the same document with @-commands that refer to node, anchors or floats.
Returns an array reference containing each node relations information.
Returns an array reference containing each section relations information.
Return the sectioning root information. It is an hash reference with the section_children key, an array reference of the top level sectioning commands relations.
Information about defined indexes, indexes merging and index entries is
available through indices_information.
$indices_information is a hash reference. The keys are
1 if the index entries should be formatted as code, 0 in the opposite case.
The index name.
In case the index is merged to another index, this key holds the name of the index the index is merged into. It takes into account indirectly merged indexes.
An array reference containing index entry structures for index entries
associated with the index. The index entry could be associated to
@-commands like @cindex, or @item in @vtable, or definition
commands entries like @deffn.
The keys of the index entry structures are
The index name associated to the command. Not modified if the corresponding
index is merged in another index (with @synindex, for example).
The element in the parsed tree associated with the @-command holding the index entry.
The number of the index entry.
The following shows a partial view of $indices_information corresponding to the default indexes cp and fn, the fn index having its entries formatted as code and the indexes corresponding to the following texinfo
@defindex some
@defcodeindex code
$index_names = {'cp' => {'name' => 'cp', 'in_code' => 0, },
'fn' => {'name' => 'fn', 'in_code' => 1, },
'some' => {'name' => 'some', 'in_code' => 0},
'code' => {'name' => 'code', 'in_code' => 1}};
Next: Getting errors and warnings , Previous: Getting document information , Up: Texinfo::Document METHODS [Contents][Index]
Merged and sorted document indexes are also available. Parsed indexes are not merged nor sorted, Texinfo::Indices functions are called to merge or sort the indexes the first time the following methods are called. The results are afterwards associated to the document and simply returned.
Merge indexes if needed and return merged indexes. The $merged_indices returned is a hash reference whose keys are the index names and values arrays of index entry structures described in index_entries.
Texinfo::Indices::merge_indices
is used to merge the indexes.
It is not useful to call this function directly if indexes are sorted, as it is already called by index sorting functions.
In general, the sorting methods should not be called directly, instead Index sorting Converter methods should be used, which already call the following functions.
sorted_indices_by_letter returns the indices sorted by index and letter,
while sorted_indices_by_index returns the indexes with all entries
of an index together.
By default, indexes are sorted according to the Unicode Collation Algorithm defined in the Unicode Technical Standard #10, without language-specific collation tailoring. If $use_unicode_collation is set to 0, the sorting will not use the Unicode Collation Algorithm and simply sort according to the codepoints. If $locale_lang is set, the language is used for linguistic tailoring of the sorting, if possible.
When sorting by letter, an array reference of letter hash references is associated with each index name. Each letter hash reference has two keys, a letter key with the letter, and an entries key with an array reference of sorted index entries beginning with the letter. The letter is a character string suitable for sorting letters, but is not necessarily the best to use for output.
When simply sorting, the array of the sorted index entries is associated with the index name.
The optional $converter argument is used for error reporting, if not defined, the $document is used.
Texinfo::Indices::sort_indices_by_index
and Texinfo::Indices::sort_indices_by_letter
are used to sort the indexes, if needed.
In general, those methods should not be called directly, instead
Texinfo::Convert::Converter::get_converter_indices_sorted_by_index
and Texinfo::Convert::Converter::get_converter_indices_sorted_by_letter
should be used. The Texinfo::Convert::Converter methods call
sorted_indices_by_index and sorted_indices_by_letter.
Next: Getting customization options values registered in document , Previous: Merging and sorting indexes , Up: Texinfo::Document METHODS [Contents][Index]
A document has a list of error and warning messages associated, that is used to
register errors and warning messages in. To get the errors registered in the
document, the errors method should be called.
This function returns as the errors since setting up the $document (or calling the function). The returned $error_warnings_list is an array of hash references one for each error, warning or error line continuation. The format of these hash references is described Texinfo::Report::count_errors.
Next: Registering information in document , Previous: Getting errors and warnings , Up: Texinfo::Document METHODS [Contents][Index]
By default, customization information is registered in a document object just after parsing the Texinfo code. Structuring and tree transformation methods then get customization variables values from the document object they have in argument. The customization variables set by default may be a subset selected to be useful for structuring and tree transformation codes.
To retrieve Texinfo customization variables you can call get_conf:
Returns the value of the Texinfo customization variable $variable_name
(possibly undef), if the variable value was registered in the document,
or undef.
Next: Methods for Perl and C code interactions , Previous: Getting customization options values registered in document , Up: Texinfo::Document METHODS [Contents][Index]
Some information can be registered in the document.
The $options hash reference holds options for the document. These options
should be Texinfo customization options. Usually, the options registered in
the document contain those useful for structuring and tree transformation
getting place between Texinfo code parsing and conversion to output formats.
Indeed, document customization options are mainly accessed by structuring and
tree transformation methods (by calling get_conf). The options should in general be registered before
the calls to get_conf.
Add $value $key global information to $document. This method
should not be generally useful, as document global information is already
set by the Texinfo parser. The information set should be available through
the next calls to global_information.
The method should in general be called before the calls to
global_information.
Previous: Registering information in document , Up: Texinfo::Document METHODS [Contents][Index]
The parsing of Texinfo code, structuring and transformations of the document and tree called through Texinfo Perl modules may be done by pure Perl modules or by Perl XS extensions in native code (written in C). In general, it makes no difference whether pure Perl or C code is used. When the document and tree are modified through native code based on C code, the Perl data are automatically rebuilt when calling the accessors described previously. In some cases, however, specific functions need to be called to pass information from C data to Perl or perform actions related to C data.
When the tree is directly accessed in Perl (not through a document)
but is modified by C code, when the Perl tree holds only a reference to
C data, but no Perl data, or when you want to update all the Perl data
before doing changes in Perl only, you can build the Perl data from the C data
with build_tree:
Return a $perl_tree, built from C data. If there is no Perl extensions in C, the tree is returned as is. The tree built is based on the Texinfo parsed document data associated to the Texinfo tree $tree.
If the optional $no_store argument is set, remove the C data. It may be useful if you call functions that modify the Perl tree only, and not the C data, followed by functions call that output the result and uses the C data if present. Removing the C data makes sure that the output is not based on unmodified C data, but on the modified Perl data.
Note that the Perl tree associated to a document is rebuilt from C data
when calling $document->tree(). Similarly, the tree is rebuilt when
calling other accessors that depend on the document tree. Therefore
build_tree should mainly be called when there is no document associated to a
tree and $document->tree() cannot be called to rebuild the tree,
or with the $no_store argument, if you want to remove the link with C data.
Some methods allow to release the memory held by C data associated to a Texinfo parsed document:
Release the C data corresponding to $document.
Next: Texinfo::Document AUTHOR , Previous: Texinfo::Document METHODS , Up: Texinfo::Document [Contents][Index]
Texinfo::Parser. Texinfo::Structuring.
Next: Texinfo::Document COPYRIGHT AND LICENSE , Previous: Texinfo::Document SEE ALSO , Up: Texinfo::Document [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Document AUTHOR , Up: Texinfo::Document [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Structuring , Previous: Texinfo::Document , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::ManipulateTree SYNOPSIS , Up: Texinfo::ManipulateTree [Contents][Index]
Texinfo::ManipulateTree - Texinfo modules common tree manipulation functions
Next: Texinfo::ManipulateTree NOTES , Previous: Texinfo::ManipulateTree NAME , Up: Texinfo::ManipulateTree [Contents][Index]
use Texinfo::ManipulateTree;
Next: Texinfo::ManipulateTree DESCRIPTION , Previous: Texinfo::ManipulateTree SYNOPSIS , Up: Texinfo::ManipulateTree [Contents][Index]
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.
Next: Texinfo::ManipulateTree METHODS , Previous: Texinfo::ManipulateTree NOTES , Up: Texinfo::ManipulateTree [Contents][Index]
Texinfo::ManipulateTree contains methods for copying and modifying the
Texinfo tree used for default conversion to output formats.
For optional tree transformation, see Texinfo::Transformations.
Next: Texinfo::ManipulateTree SEE ALSO , Previous: Texinfo::ManipulateTree DESCRIPTION , Up: Texinfo::ManipulateTree [Contents][Index]
The Texinfo tree and Texinfo tree elements used in argument of some functions
are documented in TEXINFO TREE. When customization
information is needed, an object that defines get_conf is
expected, normally a Getting customization options values registered in document object.
In @enumerate and @itemize from the $document tree, move index
entries appearing just before @item after the @item. Comment lines
between index entries are moved too.
Protect colon with protect_colon_in_tree and characters that
are special in node names after a label in menu entries (tab
dot and comma) with protect_node_after_label_in_tree.
The protection is achieved by putting protected characters
in @asis{}.
Protect comma characters, replacing , with @comma{} in tree.
Modify $element contents by protecting the first parenthesis. If $element is undef a fatal error with a backtrace will be emitted.
In tables, relate index entries preceding and following an
entry with said item. Reference one of them in the entry’s
entry_associated_element.
Next: Texinfo::ManipulateTree AUTHOR , Previous: Texinfo::ManipulateTree METHODS , Up: Texinfo::ManipulateTree [Contents][Index]
Texinfo::Document, Texinfo::Structuring, Texinfo::Transformations.
Next: Texinfo::ManipulateTree COPYRIGHT AND LICENSE , Previous: Texinfo::ManipulateTree SEE ALSO , Up: Texinfo::ManipulateTree [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::ManipulateTree AUTHOR , Up: Texinfo::ManipulateTree [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Report , Previous: Texinfo::ManipulateTree , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Structuring SYNOPSIS , Up: Texinfo::Structuring [Contents][Index]
Texinfo::Structuring - information on Texinfo::Document document structure
Next: Texinfo::Structuring NOTES , Previous: Texinfo::Structuring NAME , Up: Texinfo::Structuring [Contents][Index]
use Texinfo::Structuring qw(sectioning_structure construct_nodes_tree number_floats associate_internal_references); # $document is a parsed Texinfo::Document document. # When customization variables information is needed, it is obtained # from the $document by calling the get_conf() method. sectioning_structure($document); construct_nodes_tree($document); check_node_tree_menu_structure($document); complete_node_tree_with_menus($document); check_nodes_are_referenced($document); associate_internal_references($document); number_floats($document->floats_information());
Next: Texinfo::Structuring DESCRIPTION , Previous: Texinfo::Structuring SYNOPSIS , Up: Texinfo::Structuring [Contents][Index]
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.
Next: Texinfo::Structuring METHODS , Previous: Texinfo::Structuring NOTES , Up: Texinfo::Structuring [Contents][Index]
Texinfo::Structuring allows to collect information on a Texinfo
document structure. Thanks to sectioning_structure the hierarchy
of sectioning commands is determined. The node tree is analysed
with construct_nodes_tree. Structural checking and warning
on the consistency of menus and sectioning structure is done by
check_node_tree_menu_structure. Nodes directions are completed
with menu directions with complete_node_tree_with_menus.
Floats get their standard numbering with number_floats and
internal references are matched up with nodes, floats or anchors
with associate_internal_references.
Next: Texinfo::Structuring SEE ALSO , Previous: Texinfo::Structuring DESCRIPTION , Up: Texinfo::Structuring [Contents][Index]
No method is exported in the default case.
Most methods use the error messages list from a parsed document
for error reporting. Most also require Texinfo customization variables
information, which means an object implementing the get_conf method, in
general a parsed document with registered customization, or, sometime,
a converter (Getting and setting customization variables). Other common data needed such as target elements associated to
identifiers or refs are obtained from a parsed document, see
Texinfo::Document.
Verify that internal references (@ref and similar without fourth of
fifth argument and menu entries) have an associated node, anchor or float.
Set the normalized key in the extra hash of menu_entry_node container
for menu entries and in the first argument extra hash for internal
references @ref and similar @-commands.
Check that all the nodes are referenced (in menu, @*ref or node direction).
Should be called after complete_node_tree_with_menus in order to
have corresponding autogenerated node directions set.
Complete nodes directions with menu directions and Top node first node directions.
Check consistency of menus, sectioning and nodes directions.
Find the $node_relations node relations children based on the
sectioning structure. For the node associated with @top sectioning
command, the sections associated with parts are considered.
Complete $element by adding the $command_name, the command line
argument and @end to turn the element to a proper block command.
Returns a @menu Texinfo tree element for the node relations
$node_relations, pointing to the
children of the node obtained with the sectioning structure.
If $use_sections is set, use section names for the menu entry names. The
$lang_translations argument should be an array reference with one or two
elements. The first element of the array is the language used for translations.
The second element, if set, should be an hash reference holding
translations already done. $debug_level is an optional debugging level
similar to the DEBUG customization variable. If set, it is supplied to the
function called for translations. Translations are only needed when generating
the top node menu.
Returns a detailmenu tree element formatted as a master node.
$menus is an array reference containing the regular menus of the Top node.
$lang_translations argument should be an array reference with one or two
elements. The first element of the array is the language used for translations.
The second element, if set, should be an hash reference holding translations
already done. If $debug optional arguments is set, debugging mode
is assumed. $converter should hold information needed for
translations and error reporting. $identifier_target should hold
information on cross-reference target commands, typically obtained by
calling Texinfo::Document::labels_information.
$nodes_list should be the list of nores relations information, typically
obtained by calling Texinfo::Document::nodes_list.
$converter, if set, is used for error reporting (Registering error and warning messages). If not set, the $document is used for error reporting instead.
Returns the Texinfo tree corresponding to a single menu entry pointing to
$node_relations.
If $use_sections is set, use the section name for the menu
entry name. Returns undef if the node argument is missing.
Goes through nodes in $document tree and set directions. This functions sets, in each node relations element hash:
Hash reference with up, next and prev keys associated to the node line direction node relations.
Number the floats as described in the Texinfo manual. Sets
the float_number key in the extra hash of the float
tree elements.
Return the sectioning command name corresponding to the sectioning element $element, adjusted in order to take into account raised and lowered sections, when needed.
This function goes through the parsed document tree and gather information on the document structure for sectioning commands.
It sets section elements extra hash values:
The level in the sectioning tree hierarchy. 0 is for @top or
@part, 1 for @chapter, @appendix... This level is corrected
by @raisesections and @lowersections.
The sectioning command formatted number.
The following is set in section relations hashes:
An array holding sectioning element children. The children are also section relations.
Hash reference with up, next and prev keys associated to section directions.
Hash reference with up, next and prev keys associated to toplevel
sectioning relations directions, for elements like @top, @chapter,
@appendix, not taking into account @part elements.
After calling this function, information on the sectioning tree root
can be obtained by calling $document->sectioning_root().
Register a warning in for each @part in global commands information of
$document that is not empty.
Next: Texinfo::Structuring AUTHOR , Previous: Texinfo::Structuring METHODS , Up: Texinfo::Structuring [Contents][Index]
Texinfo manual, Texinfo::Document.
Next: Texinfo::Structuring COPYRIGHT AND LICENSE , Previous: Texinfo::Structuring SEE ALSO , Up: Texinfo::Structuring [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Structuring AUTHOR , Up: Texinfo::Structuring [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Translations , Previous: Texinfo::Structuring , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Report SYNOPSIS , Up: Texinfo::Report [Contents][Index]
Texinfo::Report - Error storing for Texinfo modules
Next: Texinfo::Report NOTES , Previous: Texinfo::Report NAME , Up: Texinfo::Report [Contents][Index]
use Texinfo::Report;
my $error_messages = [];
if ($warning_happened) {
push @$error_messages, Texinfo::Report::line_warn(
sprintf(__("\@%s is wrongly used"),
$current->{'cmdname'}), $current->{'source_info'},
0, $converter->get_conf('DEBUG'));
}
foreach my $error_message (@$error_messages) {
warn $error_message->{'error_line'};
}
Next: Texinfo::Report DESCRIPTION , Previous: Texinfo::Report SYNOPSIS , Up: Texinfo::Report [Contents][Index]
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.
Next: Texinfo::Report METHODS , Previous: Texinfo::Report NOTES , Up: Texinfo::Report [Contents][Index]
The Texinfo::Report module helps with error handling. Errors
and warnings can be setup, stored and retrieved later on.
This module methods are used by the Texinfo::Parser and
Texinfo::Convert::Converter modules.
Next: Texinfo::Report AUTHOR , Previous: Texinfo::Report DESCRIPTION , Up: Texinfo::Report [Contents][Index]
No method is exported in the default case.
The methods allow registering errors and warnings.
This function returns as $error_count the count of errors in the error messages list (as opposed to warnings). The $error_warnings_list is an array of hash references one for each error, warning or error line continuation. Each of these has the following keys:
If set, the line is a continuation line of a message.
The text of the error formatted with the macro name, as needed.
The file name where the error or warning occurs.
The line number of the error or warning.
The user macro name that is expanded at the location of the error or warning.
The text of the error.
May be warning, or error.
Register a warning or an error message structure. The $text is the text of
the error or warning. The mandatory $error_location_info holds the
information on the error or warning location. The $error_location_info
reference on hash may be obtained from Texinfo elements source_info keys.
It may also be setup to point to a file name, using the file_name key and to
a line number, using the line_nr key. The file_name key value should be
a binary string.
The $continuation optional arguments, if true, conveys that the line is a continuation line of a message.
The $debug optional integer arguments sets the debug level.
The $silent optional arguments, if true, suppresses the output of a message that is output immediatly if debugging is set.
The source_info key of Texinfo tree elements is described in more details in Texinfo::Parser source_info.
Returns a document-wide error or warning message structure. $text is the error or warning message. The $program_name is prepended to the message, if defined. The $continuation optional arguments, if true, conveys that the line is a continuation line of a message.
Next: Texinfo::Report COPYRIGHT AND LICENSE , Previous: Texinfo::Report METHODS , Up: Texinfo::Report [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Report AUTHOR , Up: Texinfo::Report [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Transformations , Previous: Texinfo::Report , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Translations SYNOPSIS , Up: Texinfo::Translations [Contents][Index]
Texinfo::Translations - Translations of output documents strings for Texinfo modules
Next: Texinfo::Translations NOTES , Previous: Texinfo::Translations NAME , Up: Texinfo::Translations [Contents][Index]
@ISA = qw(Texinfo::Translations);
Texinfo::Translations::configure('LocaleData');
my $tree_translated
= Texinfo::Translations::gdt('See {reference} in @cite{{book}}',
[$converter->get_conf('documentlanguage')],
{'reference' => $tree_reference,
'book' => {'text' => $book_name}});
Next: Texinfo::Translations DESCRIPTION , Previous: Texinfo::Translations SYNOPSIS , Up: Texinfo::Translations [Contents][Index]
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.
Next: Texinfo::Translations METHODS , Previous: Texinfo::Translations NOTES , Up: Texinfo::Translations [Contents][Index]
The Texinfo::Translations module helps with translations
in output documents.
Translation of error messages is not described here, some
elements are in Texinfo::Common __ and __p.
Next: Texinfo::Translations SEE ALSO , Previous: Texinfo::Translations DESCRIPTION , Up: Texinfo::Translations [Contents][Index]
No method is exported.
The configure method sets the translation files base directory. If not
called, system defaults are used.
$localesdir is the directory where translation files are found. The directory structure and files format should follow the conventions expected for gettext based internationalization. The $strings_textdomain is optional, if set, it determines the translation domain.
The new_lang_translation method sets up a lang translation object that
is used as argument inthe other method, that contains the language and
associated already translated strings.
$lang is the language of the returned lang translations. $locale encoding is optional and should be the encoding used to encode character strings to for environment variables. In general, you should base it on the COMMAND_LINE_ENCODING customization variable value.
The returned $lang_translations is an array reference. The first element of the array is the language. The second element is the language encoded to the local encoding. The third element should be set to an hash reference holding translations already done.
The gdt and pgdt methods are used to translate strings to be output in
converted documents, and return a Texinfo tree. The gdt_string is similar
but returns a simple string, for already converted strings.
The $string is a string to be translated. With gdt
the function returns a Texinfo tree, as the string is interpreted
as Texinfo code after translation. With gdt_string a string
is returned.
The $lang_translations argument should be an array reference with one or two elements. The first element of the array is the language used for the translation. The second element, if set, should be an hash reference holding translations already done.
$replaced_substrings is an optional hash reference specifying
some substitution to be done after the translation. The key of the
$replaced_substrings hash reference identifies what is to be substituted.
In the string to be translated word in brace matching keys of
$replaced_substrings are replaced.
For gdt, the value is a Texinfo tree element that is substituted in the
resulting Texinfo tree. For gdt_string, the value is a string that
is replaced in the resulting string.
$debug_level is an optional debugging level supplied to gdt, similar to
the DEBUG customization variable. If set, the debug level minus one is
passed to the Texinfo string parser called in gdt.
The $translation_context is optional. If not undef this is a translation
context string for $string. It is the first argument of pgettext
in the C API of Gettext.
For example, in the following call, the string
See {reference} in @cite{{book}} is translated, then
parsed as a Texinfo string, with {reference} substituted by
$tree_reference in the resulting tree, and {book}
replaced by the associated Texinfo tree text element:
$tree = gdt('See {reference} in @cite{{book}}', ['ca'],
{'reference' => $tree_reference,
'book' => {'text' => $book_name}});
By default, gdt and gdt_string call cache_translate_string to use a
gettext-like infrastructure to retrieve the translated strings, using the
texinfo_document domain. You can change the method used to retrieve the
translated strings by providing a $translate_string_method argument. If not
undef it should be a reference on a function that is called instead of
cache_translate_string. The $object is passed as first argument of the
$translate_string_method, the other arguments are the same as
cache_translate_string
arguments.
Same to gdt except that the $translation_context is not optional.
Calls gdt. This function is useful to mark strings with a
translation context for translation. This function is similar to pgettext
in the Gettext C API.
By default, in gdt, gdt_string and pgdt a string is translated with
cache_translate_string.
The $string is a string to be translated. The $lang_translations
argument should be an array reference with one or two elements. The first
element of the array is the language used for the translation. The second
element, if set, should be an hash reference holding translations already done.
If the language is undef or an empty string, the input string does not
need to be translated. The $translation_context is optional. If not
undef this is a translation context string for $string. It is the first
argument of pgettext in the C API of Gettext.
cache_translate_string uses a gettext-like infrastructure to retrieve the
translated strings, using the texinfo_document domain. Returns an array
reference with the translated string as first element, or undef if the
input string should be used as translation. The second element of the
reference array, if present, should be the Texinfo tree corresponding to
the translated string, without the braced arguments substituted.
Next: Texinfo::Translations AUTHOR , Previous: Texinfo::Translations METHODS , Up: Texinfo::Translations [Contents][Index]
Next: Texinfo::Translations COPYRIGHT AND LICENSE , Previous: Texinfo::Translations SEE ALSO , Up: Texinfo::Translations [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Translations AUTHOR , Up: Texinfo::Translations [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Indices , Previous: Texinfo::Translations , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Transformations NOTES , Up: Texinfo::Transformations [Contents][Index]
Texinfo::Transformations - transformations of Texinfo tree
Next: Texinfo::Transformations DESCRIPTION , Previous: Texinfo::Transformations NAME , Up: Texinfo::Transformations [Contents][Index]
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.
Next: Texinfo::Transformations METHODS , Previous: Texinfo::Transformations NOTES , Up: Texinfo::Transformations [Contents][Index]
Includes miscellaneous methods such as as
insert_nodes_for_sectioning_commands that adds nodes for sectioning commands
without nodes and complete_tree_nodes_menus_in_document 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.
Next: Texinfo::Transformations SEE ALSO , Previous: Texinfo::Transformations DESCRIPTION , Up: Texinfo::Transformations [Contents][Index]
No method is exported in the default case.
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.
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.
This function adds empty @unnumbered and similar commands in a
$document tree to fill gaps in sectioning. This may be used, for example,
when converting from a format that can handle gaps in sectioning.
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 without node in $document
tree.
menu_to_simple_menu transforms the tree of a menu tree element.
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 hash (#) character at the beginning of line such that they would not be
considered as lines to be processed by the CPP processor. The $document
argument is optional. If defined, the $document is used for error reporting
in case an hash character could not be protected because it appeared in a raw
formatted environment (@tex, @html...).
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 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.
Next: Texinfo::Transformations AUTHOR , Previous: Texinfo::Transformations METHODS , Up: Texinfo::Transformations [Contents][Index]
Texinfo manual, Texinfo::Parser, Texinfo::ManipulateTree.
Next: Texinfo::Transformations COPYRIGHT AND LICENSE , Previous: Texinfo::Transformations SEE ALSO , Up: Texinfo::Transformations [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Transformations AUTHOR , Up: Texinfo::Transformations [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::OutputUnits , Previous: Texinfo::Transformations , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Indices SYNOPSIS , Up: Texinfo::Indices [Contents][Index]
Texinfo::Indices - merging and sorting indices from Texinfo
Next: Texinfo::Indices NOTES , Previous: Texinfo::Indices NAME , Up: Texinfo::Indices [Contents][Index]
use Texinfo::Indices;
# $document is a parsed Texinfo::Document document.
my $indices_information = $document->indices_information();
my $merged_index_entries
= Texinfo::Indices::merge_indices($indices_information);
# $converter is a converter object
my $index_entries_sorted;
if ($sort_by_letter) {
$index_entries_sorted
= Texinfo::Indices::sort_indices_by_letter($document,
$converter);
} else {
$index_entries_sorted
= Texinfo::Indices::sort_indices_by_index($document,
$converter);
}
Next: Texinfo::Indices DESCRIPTION , Previous: Texinfo::Indices SYNOPSIS , Up: Texinfo::Indices [Contents][Index]
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.
Next: Texinfo::Indices METHODS , Previous: Texinfo::Indices NOTES , Up: Texinfo::Indices [Contents][Index]
merge_indices may be used to merge indices. Document indices may be sorted
with sort_indices_by_index or sort_indices_by_letter. Other functions
deal with formatting of index entries as text or getting information on
index entry.
Note that, in general, the functions used to merge or sort indices should not be called directly, corresponding functions in Texinfo::Document already call the functions in this module, and, in addition, cache the result with the document. Furthermore, it should be even better to call converter functions, which call document functions.
Next: Texinfo::Indices SEE ALSO , Previous: Texinfo::Indices DESCRIPTION , Up: Texinfo::Indices [Contents][Index]
No method is exported.
Return a string suitable as a sort string, for index entries.
$document_info is used by C code to retrieve the document data,
using the document_descriptor key. $document_info can be a
converter based on Texinfo::Convert::Converter, a Texinfo::Document
document, otherwise document_descriptor need, in general, to be
set up explicitely.
The tree element index entry processed is $index_entry_element,
and can be a @subentry. $main_entry is the main index entry
that can be used to gather information.
The $options are options used for Texinfo to text conversion for the generation of the sort string. If the sort string is supposed to be output, the $options are typically obtained from setup_index_entry_keys_formatting.
If $prefer_reference_element is set, prefer an untranslated element for the formatting as sort string.
Return the $index_entry leading text $text or textual command Texinfo
tree hash reference $command. Here textual commands means accent
commands, brace commands without arguments used for character and glyph
insertion and @U.
This method can in particular be used to format the leading letter
of an index entry using $command instead of the sort string set by
sort_indices_by_letter.
Returns a structure holding all the index entries by index name
with all the entries of merged indices merged with those of the indice
merged into. The $indices_information argument should be an hash reference
with indices information, it is described in details in
Texinfo::Document::indices_information.
The $merged_indices returned is a hash reference whose keys are the index names and values arrays of index entry structures described in details in Texinfo::Document index_entries.
In general, this method should not be called directly, instead
Texinfo::Document::merged_indices
should be called on a document, which calls merge_indices if needed and
associate the merged indices to the document.
Return options relevant for index keys sorting for conversion of Texinfo to text to be output.
sort_indices_by_letter sorts by index and letter, while
sort_indices_by_index sort all entries of an index together.
Indices are obtained from $document, and should have been merged
previously, in general by using
Texinfo::Document::merged_indices.
In both cases, a hash reference with index names as keys $index_entries_sorted
is returned.
By default, indices are sorted according to the Unicode Collation Algorithm defined in the Unicode Technical Standard #10, without language-specific collation tailoring. If $use_unicode_collation is set to 0, the sorting will not use the Unicode Collation Algorithm and simply sort according to the codepoints. If $locale_lang is set, the language is used for linguistic tailoring of the sorting, if possible.
When sorting by letter, an array reference of letter hash references is associated with each index name. Each letter hash reference has two keys, a letter key with the letter, and an entries key with an array reference of sorted index entries beginning with the letter. The letter is a character string suitable for sorting letters, but is not necessarily the best to use for output.
When simply sorting, the array of the sorted index entries is associated with the index name.
The optional argument $converter is used for error reporting if present, otherwise the $document is used.
In general, those methods should not be called directly, instead
Texinfo::Document::sorted_indices_by_index
or Texinfo::Document::sorted_indices_by_letter
should be called on a document. The Texinfo::Document functions call
sort_indices_by_index or sort_indices_by_letter if needed and associate
the sorted indices to the document.
Next: Texinfo::Indices AUTHOR , Previous: Texinfo::Indices METHODS , Up: Texinfo::Indices [Contents][Index]
Texinfo manual, Texinfo::Document.
Next: Texinfo::Indices COPYRIGHT AND LICENSE , Previous: Texinfo::Indices SEE ALSO , Up: Texinfo::Indices [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Indices AUTHOR , Up: Texinfo::Indices [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::Texinfo , Previous: Texinfo::Indices , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::OutputUnits SYNOPSIS , Up: Texinfo::OutputUnits [Contents][Index]
Texinfo::OutputUnits - setup and manage Texinfo document output units
Next: Texinfo::OutputUnits NOTES , Previous: Texinfo::OutputUnits NAME , Up: Texinfo::OutputUnits [Contents][Index]
use Texinfo::OutputUnits qw(split_by_node split_by_section split_pages
units_directions units_file_directions);
# $document is a parsed Texinfo::Document document.
# When customization variables information is needed, it is obtained
# from the $document by calling the get_conf() method.
my $identifier_target = $document->labels_information();
my $output_units;
if ($split_at_nodes) {
$output_units = split_by_node($document);
} else {
$output_units = split_by_section($document);
}
my $nodes_list = $document->nodes_list();
split_pages($output_units, $nodes_list, $split);
units_directions($identifier_target, $output_units,
$nodes_list, $document->get_conf('DEBUG'));
units_file_directions($output_units);
Next: Texinfo::OutputUnits DESCRIPTION , Previous: Texinfo::OutputUnits SYNOPSIS , Up: Texinfo::OutputUnits [Contents][Index]
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.
Next: Texinfo::OutputUnits METHODS , Previous: Texinfo::OutputUnits NOTES , Up: Texinfo::OutputUnits [Contents][Index]
You can convert a Texinfo parsed document to an output format in a Converter code by first splitting the nodes and sectioning commands in units and then converting those units. We will call the main unit of output documents an output unit. Usually a node is associated with a following sectioning command, while a sectioning command is associated with a previous node; they both together make up the output unit. Either the node or the sectioning command is considered to be the main element component.
The module provides methods to setup output units associated with
node and sectioning commands of a Texinfo parsed document. With
split_by_node nodes are used as the main component for the separation of
output units, while with split_by_section the sectioning command elements
are used to separate output units. The first mode is typical of Info format,
while the second corresponds better to a traditional book. Note that the
result is different when there are unassociated sectioning commands or nodes,
in the usual case of each node being associated with a sectioning command and
each sectioning command being associated with a node, splitting by node or by
section does not make much difference as each output unit will consist of the
node and the associated section in both cases.
Output units are used for conversion to HTML and Info output formats. See
Texinfo::Convert::Converter::convert_output_unit
for more information on conversion of output units in Converters. Output units
are not relevant for all the formats, the Texinfo tree can also be converted
directly, see Texinfo::Convert::Converter::output_tree.
The output units may be further grouped in pages, which are not pages as
in book pages, but more like web pages, and hold series of output units.
The output units may have directions to other output units prepared
by units_directions. units_file_directions should also
set direction related to files, provided files are associated with
output units by the user.
Next: Texinfo::OutputUnits SEE ALSO , Previous: Texinfo::OutputUnits DESCRIPTION , Up: Texinfo::OutputUnits [Contents][Index]
No method is exported in the default case.
Next: Grouping output units in pages , Up: Texinfo::OutputUnits METHODS [Contents][Index]
Output units are hash references created with the following keys:
unit_typeThe type of the output unit. Set to unit for output units associated
with nodes and sectioning commands.
unit_commandMain node or sectioning command associated with the output unit.
unit_contentsThis array reference holds all the nodes and sectioning commands Texinfo tree
elements associated with the output unit (in order). The Texinfo tree nodes
and sectioning commands elements have an associated_unit key set that points
to the output unit.
tree_unit_directionsHash reference with next and prev pointing to the previous and the next output unit.
Call one of the following methods to create output units and associate them with nodes and sectioning command Texinfo tree elements:
Returns a reference array of output units where a node is associated with the following sectioning commands. Sectioning commands without nodes are also with the previous node, while nodes without sectioning commands are alone in their output units.
Each output unit unit_command key points to the node command associated with the output unit.
Similarly with split_by_node, returns an array of output units. This
time, lone nodes are associated with the previous sections and lone
sections makes up an output unit.
Output units unit_command keys point to the sectioning command associated with the output unit.
Next: Setting output units directions , Previous: Output units creation , Up: Texinfo::OutputUnits METHODS [Contents][Index]
You can call split_pages to group together output units:
Add the first_in_page key to each output unit in the array reference argument $output_units, set to the first output unit in the group. $nodes_list is the nodes relations list.
The first output unit in the group is based on the value of $split:
chapterThe output units are grouped at chapter or other toplevel sectioning commands.
nodeEach output unit is on its own.
sectionThe output units are grouped at sectioning commands below chapter.
No splitting, all the output units are together.
Previous: Grouping output units in pages , Up: Texinfo::OutputUnits METHODS [Contents][Index]
You can call the following methods to set output units directions:
The $identifier_target argument associates identifiers with target elements
and is generally obtained from a parsed document,
Texinfo::Document::labels_information.
The $nodes_list argument holds nodes relations, and is also
generally obtained from a parsed document.
Directions are set up for the output units in the array reference
$output_units given in argument. The corresponding hash is associated
with the directions key. In this hash, keys correspond to directions
while values are output units.
$print_debug is optional. If set, some debugging information is printed.
The following directions are set up:
The output unit itself.
Unit next.
Previous output unit.
Following node output unit in reading order. It is the next node unit, or the first in menu or the next of the up node.
Preceding node output unit.
The up, next and previous node output unit.
The up, next and previous section output unit.
For top level output units, the previous top level output unit. For other output units the up top level unit. For example, for a chapter output unit it is the previous chapter output unit, for a subsection output unit it is the chapter output unit that contains the subsection.
The next top level output unit.
In the directions reference described above for units_directions,
sets the PrevFile and NextFile directions to the output units in
previous and following files.
It also sets FirstInFile* directions for all the output units by using the directions of the first output unit in file. So, for example, FirstInFileNodeNext is the output unit associated with the next node of the first output unit node in the file for each output unit in the file.
The API for association of pages/output units to files is not defined yet.
Next: Texinfo::OutputUnits AUTHOR , Previous: Texinfo::OutputUnits METHODS , Up: Texinfo::OutputUnits [Contents][Index]
Texinfo manual, Texinfo::Document, Texinfo::Convert::Converter.
Next: Texinfo::OutputUnits COPYRIGHT AND LICENSE , Previous: Texinfo::OutputUnits SEE ALSO , Up: Texinfo::OutputUnits [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::OutputUnits AUTHOR , Up: Texinfo::OutputUnits [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::Utils , Previous: Texinfo::OutputUnits , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::Texinfo SYNOPSIS , Up: Texinfo::Convert::Texinfo [Contents][Index]
Texinfo::Convert::Texinfo - Convert a Texinfo tree to Texinfo code
Next: Texinfo::Convert::Texinfo NOTES , Previous: Texinfo::Convert::Texinfo NAME , Up: Texinfo::Convert::Texinfo [Contents][Index]
use Texinfo::Convert::Texinfo qw(convert_to_texinfo); my $texinfo_text = convert_to_texinfo($tree);
Next: Texinfo::Convert::Texinfo DESCRIPTION , Previous: Texinfo::Convert::Texinfo SYNOPSIS , Up: Texinfo::Convert::Texinfo [Contents][Index]
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.
Next: Texinfo::Convert::Texinfo METHODS , Previous: Texinfo::Convert::Texinfo NOTES , Up: Texinfo::Convert::Texinfo [Contents][Index]
Texinfo::Convert::Texinfo converts a Texinfo tree (described in
Texinfo::Parser) to Texinfo code. If the Texinfo tree results from
parsing some Texinfo document, The converted Texinfo code should be
exactly the same as the initial document, except that user defined @-macros
and @value are expanded, and some invalid code is discarded.
Next: Texinfo::Convert::Texinfo AUTHOR , Previous: Texinfo::Convert::Texinfo DESCRIPTION , Up: Texinfo::Convert::Texinfo [Contents][Index]
Converts the Texinfo tree $tree to Texinfo code.
Next: Texinfo::Convert::Texinfo COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::Texinfo METHODS , Up: Texinfo::Convert::Texinfo [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Convert::Texinfo AUTHOR , Up: Texinfo::Convert::Texinfo [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::Unicode , Previous: Texinfo::Convert::Texinfo , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::Utils SYNOPSIS , Up: Texinfo::Convert::Utils [Contents][Index]
Texinfo::Convert::Utils - miscellaneous functions usable in all converters
Next: Texinfo::Convert::Utils NOTES , Previous: Texinfo::Convert::Utils NAME , Up: Texinfo::Convert::Utils [Contents][Index]
use Texinfo::Convert::Utils;
Next: Texinfo::Convert::Utils DESCRIPTION , Previous: Texinfo::Convert::Utils SYNOPSIS , Up: Texinfo::Convert::Utils [Contents][Index]
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.
Next: Texinfo::Convert::Utils METHODS , Previous: Texinfo::Convert::Utils NOTES , Up: Texinfo::Convert::Utils [Contents][Index]
Miscellaneous methods that may be useful for backends converting Texinfo trees. This module contains the methods that can be used in converters which do not inherit from Texinfo::Convert::Converter.
Next: Texinfo::Convert::Utils SEE ALSO , Previous: Texinfo::Convert::Utils DESCRIPTION , Up: Texinfo::Convert::Utils [Contents][Index]
No method is exported in the default case.
Some methods take an optional $converter argument for error reporting, see Registering error and warning messages. Even when the caller does not inherit from Texinfo::Convert::Converter, it could implement the required interfaces and could also have a converter available in some cases, to call the functions with the converter argument set.
$heading_element is a heading command tree element. $heading_text is the already formatted heading text. if the $do_number optional argument is defined and false, no number is used and the text is returned as is. The $lang_translations optional argument should be an array reference with one or two elements. The first element of the array is the language the resulting string is translated to. The second element, if set, should be an hash reference holding translations already done. If a language is set in $lang_translations, the string is translated and the optional $debug argument is passed to the translation function.
This function returns the heading with a number and the appendix part if needed.
$entry is a Texinfo tree index entry element. The function sets up
an array with the @subentry contents. The result is returned as
contents in the $contents_element element, or undef if there is no
such content. $separator is an optional separator argument used, if given,
instead of the default: a comma followed by a space.
$element should be a @def* Texinfo tree element. The
$category, $class, $type, $name are elements corresponding
to the definition @-command line. Texinfo elements
on the @-command line corresponding to arguments in the function
definition are returned in the $arguments element.
Arguments correspond to text following the other elements
on the @-command line. If there is no argument, $arguments
will be undef.
$def_line is a def_line Texinfo tree container. This function returns a
Texinfo tree corresponding to the category of the $def_line taking the class
into account, if there is one. The $lang_translations optional argument
should be an array reference holding information on the current language and
translations. It could be obtained from the converter
current_lang_translations or be setup by a call to
Texinfo::Translations::new_lang_translation.
If $lang_translations is set,
$command_line_encoding should be set to the encoding suitable for
environment variables, usually obtained from the COMMAND_LINE_ENCODING
customization variable, and the optional $debug argument is passed to the
translation function. If the optional $converter argument is set, the
translation is done by a converter method. In that case, $lang_translations
and $debug are ignored, the converter method uses similar converter
information.
encoded_input_file_name encodes $character_string_name as an input file
name. If $doc_encoding_for_input_file_name is set, the encoding is based on
the input file content encoding, otherwise $locale_encoding is used. The
$document argument is an optional Texinfo parsed document used to get the
input document content encoding. encoded_output_file_name encodes
$character_string_name as an output file name and takes similar arguments.
Return the encoded name and the encoding used to encode the name.
The $input_file_encoding argument is optional and only available for
encoded_input_file_name. If set, it is used for the input file encoding.
It is useful if there is more precise information on the input file encoding
where the file name appeared.
$verbatiminclude is a @verbatiminclude tree element.
$include_directories is an array
reference with include directories where the file specified as
@verbatiminclude argument is searched for.
$name_encoding, $doc_encoding_for_input_file_name, $locale_encoding
and $document are encoded_input_file_name arguments. The optional $converter
argument is used to output error messages. This function returns a
@verbatim tree elements after finding the included file and reading it.
$document is a Texinfo parsed document. If @documentinfo is found
in the document, return an hash reference with
@-command names appearing in @documentinfo as keys associated to
an array reference as value containing the @-commands Texinfo tree elements.
Otherwise, returns undef.
Next: Texinfo::Convert::Utils AUTHOR , Previous: Texinfo::Convert::Utils METHODS , Up: Texinfo::Convert::Utils [Contents][Index]
Texinfo::Common, Texinfo::Convert::Converter and Texinfo::Translations.
Next: Texinfo::Convert::Utils COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::Utils SEE ALSO , Up: Texinfo::Convert::Utils [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Convert::Utils AUTHOR , Up: Texinfo::Convert::Utils [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::NodeNameNormalization , Previous: Texinfo::Convert::Utils , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::Unicode SYNOPSIS , Up: Texinfo::Convert::Unicode [Contents][Index]
Texinfo::Convert::Unicode - Representation as Unicode characters
Next: Texinfo::Convert::Unicode NOTES , Previous: Texinfo::Convert::Unicode NAME , Up: Texinfo::Convert::Unicode [Contents][Index]
use Texinfo::Convert::Unicode qw(unicode_accent encoded_accents unicode_text); use Texinfo::Convert::Text qw(convert_to_text); my ($contents_element, $stack) = Texinfo::Common::find_innermost_accent_contents($accent); my $formatted_accents = encoded_accents($converter, convert_to_text($contents_element), $stack, $encoding, \&Texinfo::Text::ascii_accent_fallback);
Next: Texinfo::Convert::Unicode DESCRIPTION , Previous: Texinfo::Convert::Unicode SYNOPSIS , Up: Texinfo::Convert::Unicode [Contents][Index]
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.
Next: Texinfo::Convert::Unicode METHODS , Previous: Texinfo::Convert::Unicode NOTES , Up: Texinfo::Convert::Unicode [Contents][Index]
Texinfo::Convert::Unicode provides methods dealing with Unicode
representation and conversion of Unicode code points, to be used in Texinfo
converters.
When an encoding supported in Texinfo is given as argument of a method of the module, the accented letters or characters returned by the method should only be represented by Unicode code points if it is known that Perl should manage to convert the Unicode code points to encoded characters in the encoding character set. Note that the actual conversion is done by Perl, not by the module.
Next: Texinfo::Convert::Unicode AUTHOR , Previous: Texinfo::Convert::Unicode DESCRIPTION , Up: Texinfo::Convert::Unicode [Contents][Index]
Return the Unicode representation of a command with brace and no argument
$command_name (like @bullet{}, @aa{} or @guilsinglleft{}),
or undef if the Unicode representation cannot be converted to encoding
$encoding.
Check that it is possible to output actual UTF-8 binary bytes
corresponding to the Unicode code point string $arg (such as
201D). Perl gives a warning and will not output UTF-8 for
Unicode non-characters such as U+10FFFF. If the optional
$output_debug argument is set, a debugging output warning
is emitted if the test of the conversion failed.
Returns 1 if the conversion is possible and can be attempted,
0 otherwise.
$encoding is the encoding the accented characters should be encoded to. If
$encoding not set, $result is set to undef. Nested accents and
their content are passed with $text and $stack. $text is the text
appearing within nested accent commands. $stack is an array reference
holding the nested accents texinfo tree elements. In general, $text is
the formatted contents and $stack the stack returned by
Texinfo::Common::find_innermost_accent_contents. The function
tries to convert as much as possible the accents to $encoding starting from the
innermost accent.
$format_accent is a function reference that is used to format the accent
commands if there is no encoded character available at some point of the
conversion of the $stack. $converter is a converter object optionaly
used by $format_accent. It may be undef if there is no need of
converter object in $format_accent.
The $set_case argument is optional. If $set_case is positive, the result is upper-cased, while if it is negative, the result is lower-cased.
Return the string width, taking into account the fact that some characters have a zero width (like composing accents) while some have a width of 2 (most chinese characters, for example).
$text is the text appearing within an accent command. $accent_command should be a Texinfo tree element corresponding to an accent command taking an argument. $index_in_stack is the position in the $accents_stack of the accent command being converted. The function returns the Unicode representation of the accented character.
Return true if the $unicode_point will be encoded in the encoding
$encoding. The $unicode_point should be specified as a four letter
string describing an hexadecimal number with letters in upper case
(such as 201D). Tables are used to determine if the $unicode_point
will be encoded, when the encoding does not cover the whole Unicode range.
If the encoding is not supported in Texinfo, the result will always be false.
Return $text with dashes and quotes corresponding, for example to --- or
', represented as Unicode code points. If $in_code is set, the text is
considered to be in code style.
Next: Texinfo::Convert::Unicode COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::Unicode METHODS , Up: Texinfo::Convert::Unicode [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Convert::Unicode AUTHOR , Up: Texinfo::Convert::Unicode [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::Text , Previous: Texinfo::Convert::Unicode , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::NodeNameNormalization SYNOPSIS , Up: Texinfo::Convert::NodeNameNormalization [Contents][Index]
Texinfo::Convert::NodeNameNormalization - Normalize and transliterate Texinfo trees
Next: Texinfo::Convert::NodeNameNormalization NOTES , Previous: Texinfo::Convert::NodeNameNormalization NAME , Up: Texinfo::Convert::NodeNameNormalization [Contents][Index]
use Texinfo::Convert::NodeNameNormalization qw(convert_to_node_identifier
normalize_transliterate_texinfo);
my $normalized = convert_to_node_identifier($node_element->{'contents'}->[0]);
my $file_name
= normalize_transliterate_texinfo($section_element->{'contents'}->[0]);
Next: Texinfo::Convert::NodeNameNormalization DESCRIPTION , Previous: Texinfo::Convert::NodeNameNormalization SYNOPSIS , Up: Texinfo::Convert::NodeNameNormalization [Contents][Index]
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.
Next: Texinfo::Convert::NodeNameNormalization METHODS , Previous: Texinfo::Convert::NodeNameNormalization NOTES , Up: Texinfo::Convert::NodeNameNormalization [Contents][Index]
Texinfo::Convert::NodeNameNormalization allows to normalize node names
with convert_to_normalized and convert_to_node_identifier.
convert_to_node_identifier follows the specification described in the Texinfo
manual HTML Xref node. This is useful whenever one want a unique identifier
for Texinfo content, which is only composed of letter, digits, - and _,
for example for @node, @float and @anchor names normalization.
convert_to_identifier leaves out the step of normalizing Top.
convert_to_normalized leaves out the step of protecting characters.
It is also possible to transliterate non-ASCII letters, instead of mangling
them, with normalize_transliterate_texinfo, losing the uniqueness feature of
normalized node names.
Another method, transliterate_protect_file_name transliterates non-ASCII
letters and protect characters that should not appear on file names.
Next: Texinfo::Convert::NodeNameNormalization AUTHOR , Previous: Texinfo::Convert::NodeNameNormalization DESCRIPTION , Up: Texinfo::Convert::NodeNameNormalization [Contents][Index]
The Texinfo $tree is returned as a string, with @-commands and spaces normalized as described in the Texinfo manual HTML Xref node. ASCII 7-bit characters other than spaces and non-ASCII characters are left as is in the resulting string.
With convert_to_node_identifier, the Texinfo $tree is returned as a
string, normalized as described in the Texinfo manual HTML Xref node.
convert_to_identifier leaves out the normalization of the name if it
is a Top node name.
The result will be poor for Texinfo trees which are not @-command arguments
(on an @-command line or in braces), for instance if the tree contains
@node or block commands.
The Texinfo $tree is returned as a string, with non-ASCII letters
transliterated as ASCII, but otherwise similar with convert_to_identifier
output. If the optional $no_unidecode argument is set, Text::Unidecode
is not used for characters whose transliteration is not built-in.
The Texinfo $tree is returned as a string, with non-ASCII letters
transliterated as ASCII. If the optional $no_unidecode argument is set,
Text::Unidecode is not used for characters whose transliteration is not
built-in.
The string $string is returned with non-ASCII letters transliterated as
ASCII, and ASCII characters not safe in file names protected as in
node normalization. If the optional $no_unidecode argument is set,
Text::Unidecode is not used for characters whose transliteration is not
built-in.
Next: Texinfo::Convert::NodeNameNormalization COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::NodeNameNormalization METHODS , Up: Texinfo::Convert::NodeNameNormalization [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Convert::NodeNameNormalization AUTHOR , Up: Texinfo::Convert::NodeNameNormalization [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::Converter , Previous: Texinfo::Convert::NodeNameNormalization , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::Text SYNOPSIS , Up: Texinfo::Convert::Text [Contents][Index]
Texinfo::Convert::Text - Convert Texinfo tree to simple text
Next: Texinfo::Convert::Text NOTES , Previous: Texinfo::Convert::Text NAME , Up: Texinfo::Convert::Text [Contents][Index]
use Texinfo::Convert::Text qw(convert_to_text text_accents);
my $result = convert_to_text($tree);
my $accents_text = text_accents($accents, 'utf-8');
# using text conversion options set in $converter derived from
# Texinfo::Convert::Converter
my $text_options = $converter->{'convert_text_options'};
set_options_code($text_options);
my $result_with_converter = convert_to_text($tree, $text_options);
reset_options_code($text_options);
Next: Texinfo::Convert::Text DESCRIPTION , Previous: Texinfo::Convert::Text SYNOPSIS , Up: Texinfo::Convert::Text [Contents][Index]
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.
Next: Texinfo::Convert::Text METHODS , Previous: Texinfo::Convert::Text NOTES , Up: Texinfo::Convert::Text [Contents][Index]
Texinfo::Convert::Text is a simple backend that converts a Texinfo tree
to simple text. It is used in converters, especially for file names.
Converters derived from Texinfo::Convert::Converter should have conversion
text options preset associated to the convert_text_options key.
The main function is convert_to_text. The text conversion options
can be modified with the set_* functions before calling convert_to_text,
and reset afterwards with the corresponding reset_* functions.
Next: Texinfo::Convert::Text AUTHOR , Previous: Texinfo::Convert::Text DESCRIPTION , Up: Texinfo::Convert::Text [Contents][Index]
Convert a Texinfo tree to simple text. $text_options is a hash reference of options.
The ASCII_GLYPH, DEBUG, DOC_ENCODING_FOR_INPUT_FILE_NAME,
COMMAND_LINE_ENCODING,
NUMBER_SECTIONS, TEST, documentlanguage, INPUT_FILE_NAME_ENCODING,
LOCALE_ENCODING and INCLUDE_DIRECTORIES options corresponding to
customization variables may be set in $text_options.
The following options may also be set:
If a converter object is passed to the function, generated error messages are passed back to the converter. See also Texinfo::Convert::Converter.
If set, the value is considered to be the encoding name texinfo accented
letters should be converted to. In the default case, this option is set from
the main program directly or through converters calling conversion to text if
the --enable-encoding option, or the ENABLE_ENCODING customization
variable is set. For file names in HTML and LaTeX, and for DocBook or Texinfo
XML, this variable should in general be set unless the output encoding is
US-ASCII.
A reference on a hash. The keys should be format names (like html,
tex), and if the corresponding value is set, the format is expanded.
If positive, the text is upper-cased, if negative, the text is lower-cased.
A somehow internal option to convert to text more suitable for alphabetical sorting rather than presentation.
$text is the text appearing within an accent command. $accent_command should be a Texinfo tree element corresponding to an accent command taking an argument. The function returns a transliteration of the accented character. The $converter argument is ignored, but needed for this function to be in argument of functions that need a fallback for accents conversion. The remaining arguments are also ignored and similarly may be needed for this function to be in argument of functions that need a fallback for accents conversion.
set_options_code sets $text_options to be in code style.
(mostly --, ---, '' and `` are kept as is). reset_options_code
undo the effect of set_options_code.
reset_options_code should always be called after set_options_code.
set_options_encoding sets enabled_encoding in $text_options
to $encoding. set_options_encoding_if_not_ascii sets enabled_encoding
in $text_options based on customization options associated to
$customization_information. In that case, enabled_encoding is set unless
the output encoding is US-ASCII even if ENABLE_ENCODING is not set.
reset_options_encoding undo the effect of set_options_encoding and
set_options_encoding_if_not_ascii and should always be called after these
functions.
$accents is an accent command that may contain other nested accent commands. The function will format the whole stack of nested accent commands and the innermost text. If $encoding is set, the formatted text is converted to this encoding as much as possible instead of being converted as simple ASCII. If $set_case is positive, the result is meant to be upper-cased, if it is negative, the result is to be lower-cased.
Next: Texinfo::Convert::Text COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::Text METHODS , Up: Texinfo::Convert::Text [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Convert::Text AUTHOR , Up: Texinfo::Convert::Text [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::Info , Previous: Texinfo::Convert::Text , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::Converter SYNOPSIS , Up: Texinfo::Convert::Converter [Contents][Index]
Texinfo::Convert::Converter - Parent class for Texinfo tree converters
Next: Texinfo::Convert::Converter NOTES , Previous: Texinfo::Convert::Converter NAME , Up: Texinfo::Convert::Converter [Contents][Index]
package Texinfo::Convert::MyConverter;
use Texinfo::Convert::Converter;
@ISA = qw(Texinfo::Convert::Converter);
sub converter_defaults ($;$) {
return \%myconverter_defaults;
}
sub converter_initialize($) {
my $self = shift;
...
}
sub conversion_initialization($;$) {
my $self = shift;
my $document = shift;
if ($document) {
$self->set_document($document);
}
$self->set_global_document_commands('before', \@global_commands);
...
$self->{'document_context'} = [{}];
...
}
sub conversion_finalization($) {
my $self = shift;
}
sub convert_tree($$) {
...
}
sub convert($$) {
my $self = shift;
my $document = shift;
$self->conversion_initialization($document);
...
$self->conversion_finalization();
}
sub output($$) {
my $self = shift;
my $document = shift;
$self->conversion_initialization($document);
...
$self->conversion_finalization();
...
}
# if some data needs to be released explicitly
sub converter_destroy($) {
my $self = shift;
...
}
# end of Texinfo::Convert::MyConverter
my $converter = Texinfo::Convert::MyConverter->converter();
$converter->output($texinfo_parsed_document);
Next: Texinfo::Convert::Converter DESCRIPTION , Previous: Texinfo::Convert::Converter SYNOPSIS , Up: Texinfo::Convert::Converter [Contents][Index]
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.
Next: Texinfo::Convert::Converter METHODS , Previous: Texinfo::Convert::Converter NOTES , Up: Texinfo::Convert::Converter [Contents][Index]
Texinfo::Convert::Converter is a super class that can be used to
simplify converters initialization. The class also provide some
useful methods. In turn, the converter should define some methods for
conversion. In general convert_tree, output and convert should be
defined.
The convert_tree method is mandatory and should convert portions of Texinfo
tree. Takes a $converter and Texinfo tree $tree in arguments. Returns
the converted output.
This method should not perform converter initialization, as it should only be called with converter setup for immediate conversion, in general when conversion is already ongoing.
The output method is used by converters as entry point for conversion
to a file with headers and so on. This method should be implemented by
converters. output is called from texi2any. output takes a
$converter and a Texinfo parsed document Texinfo::Document $document
as arguments.
Texinfo::Convert::Converter implements a generic output_tree
function suitable for conversion of the Texinfo tree, with the conversion
result output into a file or returned from the function. output_tree
takes a $converter and a Texinfo parsed document Texinfo::Document
$document as arguments. In a converter that uses output_tree,
output is in general defined as:
sub output($$) {
my $self = shift;
my $document = shift;
return $self->output_tree($document);
}
In general, output and output_tree output to files and return undef.
When the output file name is an empty string, however, it is customary
for output and output_tree to return the output as a character string
instead. The output file name is obtained in output_tree through a call to
determine_files_and_directory.
In general determine_files_and_directory is also used when output_tree is not used.
Entry point for the conversion of a Texinfo parsed document to an output
format, without the headers usually done when outputting to a file. convert
takes a $converter and a Texinfo parsed document Texinfo::Document
$document as arguments. Returns the output as a character string. Not
mandatory, not called from texi2any, but used in the texi2any test suite.
Two methods, converter_defaults and converter_initialize are
used for initialization, to give information
to Texinfo::Convert::Converter and can be redefined in converters.
To help with the conversion, the set_document function associates a
Texinfo::Document to a converter. Other methods are called in default
implementations to be redefined to call code at specific moments of the
conversion. conversion_initialization, for instance, is generally
called at the beginning of output, output_tree and convert.
conversion_finalization is generally called at the end of output_tree,
output and convert. output_tree also calls the
conversion_output_begin method before the Texinfo tree conversion to obtain
the beginning of the output. output_tree calls the
conversion_output_end method after the Texinfo tree conversion to obtain
the end of the output.
For output formats based on output units conversion, the
Texinfo::Convert::Plaintext output method could be a good starting
point. HTML and Info output are also based on output units conversion.
Output units are not relevant for all the formats, the Texinfo tree can also be
converted directly, in general by using output_tree. This is how the other
Converters are implemented.
Existing backends based on output_tree may be used as examples.
Texinfo::Convert::Texinfo together with Texinfo::Convert::PlainTexinfo,
as well as Texinfo::Convert::TextContent are trivial examples.
Texinfo::Convert::Text is less trivial, although still simple, while
Texinfo::Convert::DocBook is a real converter that is also not too complex.
The documentation of Texinfo::Common, Texinfo::OutputUnits, Texinfo::Convert::Unicode and Texinfo::Convert::Text describes modules or additional function that may be useful for backends, while the parsed Texinfo tree is described in Texinfo::Parser.
Next: Texinfo::Convert::Converter SEE ALSO , Previous: Texinfo::Convert::Converter DESCRIPTION , Up: Texinfo::Convert::Converter [Contents][Index]
Next: Conversion , Up: Texinfo::Convert::Converter METHODS [Contents][Index]
A module subclassing Texinfo::Convert::Converter is created by calling
the converter method that should be inherited from
Texinfo::Convert::Converter.
The $options hash reference holds options for the converter. These options should be Texinfo customization options. The customization options are described in the Texinfo manual or in the customization API manual.
The converter function returns a converter object (a blessed hash
reference) after checking the options and performing some initializations.
To help with the initializations, the modules subclassing Texinfo::Convert::Converter
can define two methods:
Returns a reference on a hash with defaults for the converter module
customization options or undef. The optional $options hash reference
holds options for the converter. This method is called through a converter
by converter,
but it may also be called through a converter module class.
This method is called at the end of the Texinfo::Convert::Converter
converter initialization.
Next: Output units and converter destruction , Previous: Converter Initialization , Up: Texinfo::Convert::Converter METHODS [Contents][Index]
For conversion with output and convert a document to convert should be
associated with the converter, in general the document passed in argument of
output or convert. The set_document function associates a
Texinfo::Document to a converter. This function is used in the default
implementations.
Associate $document to $converter. Also set the encoding related customization
options based on $converter customization information and information on
document encoding, and setup converter hash convert_text_options value that
can be used to call Texinfo::Convert::Text::convert_to_text.
The conversion_initialization, conversion_finalization,
conversion_output_begin and conversion_output_end can be redefined to
call code at diverse moments:
conversion_initialization is called at the beginning of output_tree and
of the default implementations of the output and convert functions.
conversion_finalization is called at the end of output_tree and of
the default output and convert methods implementations.
These functions should be redefined to have code run before a document
conversion and after the document conversion.
In the default case, conversion_initialization calls
set_document to associate the Texinfo::Document
document passed in argument to the converter. A subclass converter redefining
conversion_initialization should in general call set_document in the
redefined function too to associate the converted document to the converter.
For a converter to be reusable for multiple documents conversion, variables
values corresponding to @-commands that can be set in the document
and influence formatting should be reset at conversion initialization.
This can be done with set_global_document_commands. If the list
of such @-commands is @global_commands, the following call would reset them
to the values they had before starting the conversion:
$self->set_global_document_commands('before', \@global_commands);
conversion_output_begin returned string $beginning is output
by the output_tree calling method before the Texinfo tree conversion.
The $output_file argument is the output file path.
If $output_file is an empty string, it means that text will be returned by
the converter instead of being written to an output file.
$output_filename is, in general, the file name portion of $output_file
(without directory) but can also be set based on @setfilename.
conversion_output_end returned string $end is output
by the output_tree calling method after the Texinfo tree conversion.
The default methods implementations return an empty string.
Calling conversion_initialization and, if needed, conversion_finalization
in redefined output and convert methods is not mandated, but it is
recommended to have similar converter codes. In subclassed converters that do
not need to define conversion_initialization, calling the default
Texinfo::Convert::Converter conversion_initialization implementation is
also recommended to avoid having to explictely call set_document.
If conversion_initialization is defined in a converter subclass it is
recommended to call set_document at the very beginning of the function to
have the document associated with the converter.
If a converter uses output units, the convert_output_unit method can
be used and can be redefined if needed:
Can be used for the conversion of output units by converters.
convert_output_unit takes a $converter and an output unit
$output_unit as argument. This method is not needed for all the converters.
The implementation of
convert_output_unit of Texinfo::Convert::Converter could be suitable in
many cases. Output units are typically returned by Texinfo::OutputUnits
split_by_section
or Texinfo::OutputUnits split_by_node.
Next: Getting and setting customization variables , Previous: Conversion , Up: Texinfo::Convert::Converter METHODS [Contents][Index]
Removing output units and destroying the converter is only needed if one want to be sure that the memory held is released or reused. It is optional, and in general takes longer than having the memory be released at the end of a script.
Output units associated with a converter are removed by calling
the converter_remove_output_units method that should be inherited from
Texinfo::Convert::Converter.
Release the output units associated with a converter. It does not necessarily means that the output units are explicitly undefined, it could be that cycles in output units are removed such that Perl can release or reuse the memory.
To help with the output units release, the modules subclassing
Texinfo::Convert::Converter can define the method:
This method is called at the beginning of the Texinfo::Convert::Converter
converter output units removal.
A module subclassing Texinfo::Convert::Converter is destroyed by calling
the destroy_converter method that should be inherited from
Texinfo::Convert::Converter.
Destroy converter data.
To help with the destruction, the modules subclassing
Texinfo::Convert::Converter can define the method:
This method is called at the beginning of the Texinfo::Convert::Converter
converter destruction.
The default converter_release_output_units and converter_destroy
methods do nothing.
Next: Registering error and warning messages , Previous: Output units and converter destruction , Up: Texinfo::Convert::Converter METHODS [Contents][Index]
Texinfo::Convert::Converter implements a simple interface to
set and retrieve Texinfo customization variables. Helper
functions from diverse Texinfo modules needing customization
information expect an object implementing get_conf and/or
set_conf. The converter itself can therefore be used in
such cases.
Customization variables are typically setup when
initializing a converter with converter
and completed by Texinfo informative @-commands tree element values,
for commands such as @frenchspacing or @footnotestyle.
Set the Texinfo customization option $variable_name to $variable_value. This should rarely be used, but the purpose of this method is to be able to revert a customization that is always wrong for a given output format, like the splitting for example.
Returns the value of the Texinfo customization variable $variable_name.
Set the Texinfo customization option $variable_name to $variable_value if not set as a converter option. Returns false if the customization options was not set.
Next: Translations in output documents , Previous: Getting and setting customization variables , Up: Texinfo::Convert::Converter METHODS [Contents][Index]
Texinfo::Convert::Converter implements an interface to register error and
warning messages in the converter, that can be retrieved later on.
Underneath, Texinfo::Report is used to setup the messages data structure.
Register a warning or an error. The $text is the text of the error or warning.
The $continuation optional arguments, if true, conveys that the line is a continuation line of a message.
Register a warning or an error with a line information. The $text is the
text of the error or warning. The $error_location_info argument holds the
information on the error or warning location. The $error_location_info
reference on hash may be obtained from Texinfo elements source_info keys.
It may also be setup to point to a file name, using the file_name key and to
a line number, using the line_nr key. The file_name key value should be
a binary string.
The $continuation optional arguments, if true, conveys that the line is a continuation line of a message.
Return a reference on an array containing the error or warning messages registered in the converter. Error and warning messages are hash references as described in Texinfo::Report::count_errors.
Next: Index sorting , Previous: Registering error and warning messages , Up: Texinfo::Convert::Converter METHODS [Contents][Index]
Texinfo::Convert::Converter provides wrappers around
Texinfo::Translations methods that sets the language to the current
documentlanguage.
The cdt and pcdt methods are used to translate strings to be output in
converted documents, and return a Texinfo tree. The cdt_string is similar
but returns a simple string, for already converted strings.
The $string is a string to be translated. With cdt
the function returns a Texinfo tree, as the string is interpreted
as Texinfo code after translation. With cdt_string a string
is returned.
$replaced_substrings is an optional hash reference specifying
some substitution to be done after the translation. The key of the
$replaced_substrings hash reference identifies what is to be substituted.
In the string to be translated word in brace matching keys of
$replaced_substrings are replaced.
For cdt, the value is a Texinfo tree that is substituted in the
resulting Texinfo tree. For cdt_string, the value is a string that
is replaced in the resulting string.
The $translation_context is optional. If not undef this is a translation
context string for $string. It is the first argument of pgettext
in the C API of Gettext.
Same to cdt except that the $translation_context is not optional.
This function is useful to mark strings with a translation context for
translation. This function is similar to pgettext in the Gettext C API.
Next: Accents conversion , Previous: Translations in output documents , Up: Texinfo::Convert::Converter METHODS [Contents][Index]
You should call the following methods to sort indices in conversion:
get_converter_indices_sorted_by_letter returns the indices sorted by index
and letter, while get_converter_indices_sorted_by_index returns the indices
with all entries of an index together.
When sorting by letter, an array reference of letter hash references is associated with each index name. Each letter hash reference has two keys, a letter key with the letter, and an entries key with an array reference of sorted index entries beginning with the letter. The letter is a character string suitable for sorting letters, but is not necessarily the best to use for output.
When simply sorting, the array of the sorted index entries is associated with the index name.
The functions call Texinfo::Document::sorted_indices_by_letter
or Texinfo::Document::sorted_indices_by_index
with arguments based on USE_UNICODE_COLLATION, COLLATION_LANGUAGE and
DOCUMENTLANGUAGE_COLLATION customization options, and, if relevant, current
@documentlanguage.
Next: Conversion to XML , Previous: Index sorting , Up: Texinfo::Convert::Converter METHODS [Contents][Index]
Accent @-commands that take arguments can be nested in Texinfo code, as in
@'{@^a}. To handle this situation, a user defined function can be called
for each of the accent commands, starting by the innermost accent command. For
this the user-defined function and the outermost accent command tree elements
should be given to the convert_accents function:
$accent_command is an accent command tree elements, which may have other
accent commands tree elements nested inside. The function returns the accents
formatted either as encoded letters if $output_encoded_characters is set, or
formatted by calling \&format_accents repeatedly starting from the innermost
accent command tree element within $accent_command. The innermost accent
command argument (usually a letter), is also converted, by calling
$converter->convert_tree. If $in_upper_case is
set, the result should be uppercased.
$self is the converter in the call to convert_accents.
For the innermost accent command, $text is the text appearing within
the accent command converted. For the other accent commands,
$text is the result of the previously converted
accent command. $accent_command the Texinfo tree element corresponding
to the accent command being converted. $index_in_stack is the position
in the $accents_stack of the accent command being converted. The
$accents_stack is an array holding the nested accent command
Texinfo tree elements. The innermost tree element command is last.
$in_upper_case is optional, and, if set, the text should be put
in upper case. The function should return the converted accent argument
to be processed by the following accent command.
Next: Helper methods , Previous: Accents conversion , Up: Texinfo::Convert::Converter METHODS [Contents][Index]
Some Texinfo::Convert::Converter methods target conversion to XML.
Most methods take a $converter as argument to get some
information and use methods for error reporting.
Replace quotation marks and hyphens used to represent dash in Texinfo text with numeric XML entities.
Protect special XML characters (&, <, >, ") of $text.
Returns an XML comment for $text.
$self is an object, in general a converter. $text is the text appearing within an accent command. $accent_command should be a Texinfo tree element corresponding to an accent command taking an argument. $index_in_stack is the position in the $accents_stack of the accent command being converted. It is optional, but if not present the formatting cannot take into account the position of the accent in the current accents group being converted. $in_upper_case is optional, and, if set, the text is put in upper case. The function returns the accented letter as XML named entity if possible, falling back to numeric entities if there is no named entity and returns the argument as last resort. $use_numeric_entities is optional. If set, numerical entities are used instead of named entities if possible.
This function is similar to the accent formatting function passed
to convert_accents for Accents conversion.
$accent_command is an accent command, which may have other accent commands nested. If $in_upper_case is set, the result should be upper cased. The function returns the accents formatted as XML.
$accent_command_name is the name of an accent command. $text is the text
appearing within the accent command. Returns the accented letter as XML numeric
entity, or undef is there is no such entity.
The following hashes, defined as our variable are also available:
Values are entities or, if not available, ASCII representation of
single character non-alphabetical commands without brace such as * or :
and of commands with empty braces such as atchar, LaTeX, arrow,
quoteleft or AA.
Previous: Conversion to XML , Up: Texinfo::Convert::Converter METHODS [Contents][Index]
The module provides methods that may be useful for converter.
Most methods take a $converter as argument to get some
information and use methods for error reporting, see Registering error and
warning messages. Also to translate strings, see Translations in output
documents. For useful methods that need a converter optionally and can be
used in converters that do not inherit from Texinfo::Convert::Converter, see
Texinfo::Convert::Utils.
Create destination directory $destination_directory_path. $destination_directory_path should be a binary string, while $destination_directory_name should be a character string, that can be used in error messages. $succeeded is true if the creation was successful or uneeded, false otherwise.
Determine output file and directory, as well as names related to files. The
result depends on the presence of @setfilename, on the Texinfo input file
name, and on customization options such as OUTPUT, SUBDIR or SPLIT,
as described in the Texinfo manual. If $output_format is defined and not an
empty string, _$output_format is prepended to the default directory name.
$output_file is mainly relevant when not split and should be used as the
output file name. In general, if not split and $output_file is an empty
string, it means that text should be returned by the converter instead of being
written to an output file. This is used in the test suite.
$destination_directory is either the directory $output_file is in, or if
split, the directory where the files should be created. $output_filename
is, in general, the file name portion of $output_file (without directory)
but can also be set based on @setfilename, in particular when
$output_file is an empty string. $document_name is $output_filename
without extension. $input_basefile is based on the input Texinfo file name,
with the file name portion only (without directory).
The strings returned are text strings.
Encode $character_string_name in the same way as other file names are
encoded in the converter, based on customization variables, and possibly
on the input file encoding. Return the encoded name and the encoding
used to encode the name. The encoded_input_file_name and
encoded_output_file_name functions use different customization variables to
determine the encoding.
The $input_file_encoding argument is optional. If set, it is used for the input file encoding. It is useful if there is more precise information on the input file encoding where the file name appeared.
Note that these functions are wrappers around functions from Texinfo::Convert::Utils with the same names.
Expand today’s date, as a Texinfo tree with translations.
$float is a Texinfo tree @float element. This function
returns the caption element that should be used for the float formatting
and the $prepended Texinfo tree combining the type and label
of the float.
$float is a Texinfo tree @float element. This function
returns the type and number of the float as a Texinfo tree with
translations.
Returns the normalized file name corresponding to the $normalized node name and to the $label_element node name element contents.
Returns a normalized name $normalized_name corresponding to a sectioning command tree element $element, expanding the command argument using transliteration and characters protection. Also returns $filename the corresponding filename based on $normalized_name taking into account additional constraint on file names and adding a file extension.
Show a bug message using $message text. Use information on $element tree element if given in argument.
Set the Texinfo customization options for @-commands. $selected_commands is an array reference containing the @-commands set. $commands_location specifies where in the document the value should be taken from. The possibilities are:
Set to the values before document conversion, from defaults and command-line.
Set to the last value for the command.
Set sequentially to the values in the Texinfo preamble.
Set to the first value of the command if the first command is not in the Texinfo preamble, else set as with preamble, sequentially to the values in the Texinfo preamble.
Notice that the only effect of this function is to set a customization variable value, no @-command side effects are run, no associated customization variables are set.
For more information on the function used to set the value for each of the command, see
Texinfo::Common set_global_document_command.
$element should be an @item or @itemx tree element.
Returns a tree in which the @-command in argument of @*table
of the $element has been applied to the $element line argument,
or undef.
Returns a file name for the Top node file using either TOP_FILE
customization value, or EXTENSION customization value and $document_name.
$verbatiminclude is a @verbatiminclude tree element. This function
returns a @verbatim tree elements after finding the included file and
reading it.
Finally, there is:
At this level, the method just returns undef. It is used in the HTML
output, following the --internal-links option of texi2any
specification.
Next: Texinfo::Convert::Converter AUTHOR , Previous: Texinfo::Convert::Converter METHODS , Up: Texinfo::Convert::Converter [Contents][Index]
Texinfo::Common, Texinfo::Convert::Unicode, Texinfo::Report, Texinfo::Translations, Texinfo::Convert::Utils and Texinfo::Parser.
Next: Texinfo::Convert::Converter COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::Converter SEE ALSO , Up: Texinfo::Convert::Converter [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Convert::Converter AUTHOR , Up: Texinfo::Convert::Converter [Contents][Index]
Copyright 2011- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::HTML , Previous: Texinfo::Convert::Converter , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::Info SYNOPSIS , Up: Texinfo::Convert::Info [Contents][Index]
Texinfo::Convert::Info - Convert Texinfo tree to Info
Next: Texinfo::Convert::Info NOTES , Previous: Texinfo::Convert::Info NAME , Up: Texinfo::Convert::Info [Contents][Index]
my $converter
= Texinfo::Convert::Info->converter({'NUMBER_SECTIONS' => 0});
# output to files
$converter->output($document);
# no header nor footer output
my $converted = $converter->convert($document);
Next: Texinfo::Convert::Info DESCRIPTION , Previous: Texinfo::Convert::Info SYNOPSIS , Up: Texinfo::Convert::Info [Contents][Index]
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.
Next: Texinfo::Convert::Info METHODS , Previous: Texinfo::Convert::Info NOTES , Up: Texinfo::Convert::Info [Contents][Index]
Texinfo::Convert::Info converts a Texinfo tree to Info.
Next: Texinfo::Convert::Info AUTHOR , Previous: Texinfo::Convert::Info DESCRIPTION , Up: Texinfo::Convert::Info [Contents][Index]
Initialize converter from Texinfo to Info.
The $options hash reference holds Texinfo customization options for the converter. These options should be Texinfo customization options that can be passed to the converter. Most of the customization options are described in the Texinfo manual or in the customization API manual. Those customization options, when appropriate, override the document content.
See Texinfo::Convert::Converter for more information.
Convert a Texinfo parsed document $document and output the result in files as described in the Texinfo manual.
Convert a Texinfo parsed document $document and return the resulting output.
Convert a Texinfo tree portion $tree and return the resulting output. This function does not try to output a full document but only portions. In general it is better to call this function when conversion is already ongoing, as it requires an association to a document and a suitably initialized converter formatting state.
Next: Texinfo::Convert::Info COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::Info METHODS , Up: Texinfo::Convert::Info [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Convert::Info AUTHOR , Up: Texinfo::Convert::Info [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::DocBook , Previous: Texinfo::Convert::Info , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::HTML SYNOPSIS , Up: Texinfo::Convert::HTML [Contents][Index]
Texinfo::Convert::HTML - Convert Texinfo tree to HTML
Next: Texinfo::Convert::HTML NOTES , Previous: Texinfo::Convert::HTML NAME , Up: Texinfo::Convert::HTML [Contents][Index]
my $converter
= Texinfo::Convert::HTML->converter({'NUMBER_SECTIONS' => 0});
# output to files
$converter->output($document);
# no header nor footer output
my $converted = $converter->convert($document);
$converter->output_internal_links(); # HTML only
Next: Texinfo::Convert::HTML DESCRIPTION , Previous: Texinfo::Convert::HTML SYNOPSIS , Up: Texinfo::Convert::HTML [Contents][Index]
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.
Next: Texinfo::Convert::HTML METHODS , Previous: Texinfo::Convert::HTML NOTES , Up: Texinfo::Convert::HTML [Contents][Index]
Texinfo::Convert::HTML converts a Texinfo tree to HTML.
Next: Texinfo::Convert::HTML AUTHOR , Previous: Texinfo::Convert::HTML DESCRIPTION , Up: Texinfo::Convert::HTML [Contents][Index]
Initialize converter from Texinfo to HTML.
The $options hash reference holds Texinfo customization options for the converter. These options should be Texinfo customization options that can be passed to the converter. Most of the customization options are described in the Texinfo manual or in the customization API manual. Those customization options, when appropriate, override the document content.
See Texinfo::Convert::Converter for more information.
Convert a Texinfo parsed document $document and output the result in files as described in the Texinfo manual.
Convert a Texinfo parsed document $document and return the resulting output.
Convert a Texinfo tree portion $tree and return the resulting output. This function does not try to output a full document but only portions. In general it is better to call this function when conversion is already ongoing, as it requires an association to a document and a suitably initialized converter formatting state.
Returns text representing the links in the document. The format should
follow the --internal-links option of the texi2any
specification. This is only supported in (and relevant for) HTML.
Next: Texinfo::Convert::HTML COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::HTML METHODS , Up: Texinfo::Convert::HTML [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Convert::HTML AUTHOR , Up: Texinfo::Convert::HTML [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::TexinfoMarkup , Previous: Texinfo::Convert::HTML , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::DocBook SYNOPSIS , Up: Texinfo::Convert::DocBook [Contents][Index]
Texinfo::Convert::DocBook - Convert Texinfo tree to DocBook
Next: Texinfo::Convert::DocBook NOTES , Previous: Texinfo::Convert::DocBook NAME , Up: Texinfo::Convert::DocBook [Contents][Index]
my $converter
= Texinfo::Convert::DocBook->converter({'NUMBER_SECTIONS' => 0});
# output to files
$converter->output($document);
# no header nor footer output
my $converted = $converter->convert($document);
Next: Texinfo::Convert::DocBook DESCRIPTION , Previous: Texinfo::Convert::DocBook SYNOPSIS , Up: Texinfo::Convert::DocBook [Contents][Index]
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.
Next: Texinfo::Convert::DocBook METHODS , Previous: Texinfo::Convert::DocBook NOTES , Up: Texinfo::Convert::DocBook [Contents][Index]
Texinfo::Convert::DocBook converts a Texinfo tree to DocBook.
Next: Texinfo::Convert::DocBook AUTHOR , Previous: Texinfo::Convert::DocBook DESCRIPTION , Up: Texinfo::Convert::DocBook [Contents][Index]
Initialize converter from Texinfo to DocBook.
The $options hash reference holds Texinfo customization options for the converter. These options should be Texinfo customization options that can be passed to the converter. Most of the customization options are described in the Texinfo manual or in the customization API manual. Those customization options, when appropriate, override the document content.
See Texinfo::Convert::Converter for more information.
Convert a Texinfo parsed document $document and output the result in files as described in the Texinfo manual.
Convert a Texinfo parsed document $document and return the resulting output.
Convert a Texinfo tree portion $tree and return the resulting output. This function does not try to output a full document but only portions. In general it is better to call this function when conversion is already ongoing, as it requires an association to a document and a suitably initialized converter formatting state.
Next: Texinfo::Convert::DocBook COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::DocBook METHODS , Up: Texinfo::Convert::DocBook [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Convert::DocBook AUTHOR , Up: Texinfo::Convert::DocBook [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::TexinfoXML , Previous: Texinfo::Convert::DocBook , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::TexinfoMarkup SYNOPSIS , Up: Texinfo::Convert::TexinfoMarkup [Contents][Index]
Texinfo::Convert::TexinfoMarkup - Convert Texinfo tree to element and attribute markup
Next: Texinfo::Convert::TexinfoMarkup NOTES , Previous: Texinfo::Convert::TexinfoMarkup NAME , Up: Texinfo::Convert::TexinfoMarkup [Contents][Index]
package Texinfo::Convert::TexinfoMyMarkup;
use Texinfo::Convert::TexinfoMarkup;
@ISA = qw(Texinfo::Convert::TexinfoMarkup);
sub converter_defaults ($$) {
return %myconverter_defaults;
}
sub txi_markup_protect_text($$)
{
my $self = shift;
....
}
Next: Texinfo::Convert::TexinfoMarkup DESCRIPTION , Previous: Texinfo::Convert::TexinfoMarkup SYNOPSIS , Up: Texinfo::Convert::TexinfoMarkup [Contents][Index]
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.
Next: Texinfo::Convert::TexinfoMarkup METHODS , Previous: Texinfo::Convert::TexinfoMarkup NOTES , Up: Texinfo::Convert::TexinfoMarkup [Contents][Index]
Texinfo::Convert::TexinfoMarkup converts a Texinfo tree to the Texinfo
Markup Language which is based on nested elements with attributes, similar
to XML. All the information present in the Texinfo tree, after
expansion of @macro, @value and inclusion of include files is
kept. Texinfo::Convert::TexinfoMarkup is an abstract class, to be used as a
super class for modules implementing specific markup formatting functions
called by Texinfo::Convert::TexinfoMarkup.
The Texinfo Markup Language elements and attributes are not documented,
but the Texinfo XML output by the Texinfo::Convert::TexinfoXML subclass
(Texinfo::Convert::TexinfoXML) is a straightforward formatting as XML,
and is described by the Texinfo DTD. Therefore the Texinfo DTD can be
used as a description of the structure of both Texinfo XML and of the
more abstract Texinfo Markup Language.
Next: Texinfo::Convert::TexinfoMarkup AUTHOR , Previous: Texinfo::Convert::TexinfoMarkup DESCRIPTION , Up: Texinfo::Convert::TexinfoMarkup [Contents][Index]
Next: Formatting state information , Up: Texinfo::Convert::TexinfoMarkup METHODS [Contents][Index]
The following methods should be implemented by the modules inheriting
from Texinfo::Convert::TexinfoMarkup:
Format the $atom symbol string in a simpler way than with an element. For example in XML the formatting of the symbol is achieved with an entity.
Format $comment_string as a comment.
Called to format the Texinfo tree $element text, which is a
reference on a hash. The $element text is in the text key.
The type key value may also be set to distinguish the type of text
(Types for text elements).
Texinfo tree elements are described in details in TEXINFO TREE.
txi_markup_element is called for the formatting of empty elements. Otherwise,
txi_markup_open_element is called when an element is opened, and
txi_markup_close_element is called when an element is closed.
$format_element is the element name, $attributes is a reference on an
array containing references on arrays of pairs, one pair for each attribute, with
the attribute name as the first item of the pair and the attribute text as the
second item of the pair.
Called to format a header at the beginning of output files.
Protect special character in text for text fragments out of text
Texinfo tree elements. For example, for spaces at end of line that
are ignorable in most output formats, for @set or @macro
arguments.
Previous: Markup formatting methods defined by subclasses , Up: Texinfo::Convert::TexinfoMarkup METHODS [Contents][Index]
A method is available for subclasses to gather information on the formatting state:
Return 1 if in a context where spacing should be kept
and --- or '' left as is, for example in @code, @example.
Next: Texinfo::Convert::TexinfoMarkup SEE ALSO , Previous: Texinfo::Convert::TexinfoMarkup METHODS , Up: Texinfo::Convert::TexinfoMarkup [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Next: Texinfo::Convert::TexinfoMarkup COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::TexinfoMarkup AUTHOR , Up: Texinfo::Convert::TexinfoMarkup [Contents][Index]
Texinfo::Convert::Converter. Texinfo::Convert::TexinfoXML. The
Texinfo::Convert::TexinfoSXML is another subclass, which outputs
SXML. It is not much documented.
Previous: Texinfo::Convert::TexinfoMarkup SEE ALSO , Up: Texinfo::Convert::TexinfoMarkup [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Convert::Plaintext , Previous: Texinfo::Convert::TexinfoMarkup , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::TexinfoXML SYNOPSIS , Up: Texinfo::Convert::TexinfoXML [Contents][Index]
Texinfo::Convert::TexinfoXML - Convert Texinfo tree to TexinfoXML
Next: Texinfo::Convert::TexinfoXML NOTES , Previous: Texinfo::Convert::TexinfoXML NAME , Up: Texinfo::Convert::TexinfoXML [Contents][Index]
my $converter
= Texinfo::Convert::TexinfoXML->converter({'NUMBER_SECTIONS' => 0});
# output to files
$converter->output($document);
# no header nor footer output
my $converted = $converter->convert($document);
Next: Texinfo::Convert::TexinfoXML DESCRIPTION , Previous: Texinfo::Convert::TexinfoXML SYNOPSIS , Up: Texinfo::Convert::TexinfoXML [Contents][Index]
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.
Next: Texinfo::Convert::TexinfoXML METHODS , Previous: Texinfo::Convert::TexinfoXML NOTES , Up: Texinfo::Convert::TexinfoXML [Contents][Index]
Texinfo::Convert::TexinfoXML converts a Texinfo tree to TexinfoXML.
Next: Texinfo::Convert::TexinfoXML AUTHOR , Previous: Texinfo::Convert::TexinfoXML DESCRIPTION , Up: Texinfo::Convert::TexinfoXML [Contents][Index]
Initialize converter from Texinfo to TexinfoXML.
The $options hash reference holds Texinfo customization options for the converter. These options should be Texinfo customization options that can be passed to the converter. Most of the customization options are described in the Texinfo manual or in the customization API manual. Those customization options, when appropriate, override the document content.
See Texinfo::Convert::Converter for more information.
Convert a Texinfo parsed document $document and output the result in files as described in the Texinfo manual.
Convert a Texinfo parsed document $document and return the resulting output.
Convert a Texinfo tree portion $tree and return the resulting output. This function does not try to output a full document but only portions. In general it is better to call this function when conversion is already ongoing, as it requires an association to a document and a suitably initialized converter formatting state.
Next: Texinfo::Convert::TexinfoXML COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::TexinfoXML METHODS , Up: Texinfo::Convert::TexinfoXML [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Convert::TexinfoXML AUTHOR , Up: Texinfo::Convert::TexinfoXML [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::TreeElement , Previous: Texinfo::Convert::TexinfoXML , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Convert::Plaintext SYNOPSIS , Up: Texinfo::Convert::Plaintext [Contents][Index]
Texinfo::Convert::Plaintext - Convert Texinfo tree to Plaintext
Next: Texinfo::Convert::Plaintext NOTES , Previous: Texinfo::Convert::Plaintext NAME , Up: Texinfo::Convert::Plaintext [Contents][Index]
my $converter
= Texinfo::Convert::Plaintext->converter({'NUMBER_SECTIONS' => 0});
# output to files
$converter->output($document);
# no header nor footer output
my $converted = $converter->convert($document);
Next: Texinfo::Convert::Plaintext DESCRIPTION , Previous: Texinfo::Convert::Plaintext SYNOPSIS , Up: Texinfo::Convert::Plaintext [Contents][Index]
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.
Next: Texinfo::Convert::Plaintext METHODS , Previous: Texinfo::Convert::Plaintext NOTES , Up: Texinfo::Convert::Plaintext [Contents][Index]
Texinfo::Convert::Plaintext converts a Texinfo tree to Plaintext.
Next: Texinfo::Convert::Plaintext AUTHOR , Previous: Texinfo::Convert::Plaintext DESCRIPTION , Up: Texinfo::Convert::Plaintext [Contents][Index]
Initialize converter from Texinfo to Plaintext.
The $options hash reference holds Texinfo customization options for the converter. These options should be Texinfo customization options that can be passed to the converter. Most of the customization options are described in the Texinfo manual or in the customization API manual. Those customization options, when appropriate, override the document content.
See Texinfo::Convert::Converter for more information.
Convert a Texinfo parsed document $document and output the result in files as described in the Texinfo manual.
Convert a Texinfo parsed document $document and return the resulting output.
Convert a Texinfo tree portion $tree and return the resulting output. This function does not try to output a full document but only portions. In general it is better to call this function when conversion is already ongoing, as it requires an association to a document and a suitably initialized converter formatting state.
Next: Texinfo::Convert::Plaintext COPYRIGHT AND LICENSE , Previous: Texinfo::Convert::Plaintext METHODS , Up: Texinfo::Convert::Plaintext [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Convert::Plaintext AUTHOR , Up: Texinfo::Convert::Plaintext [Contents][Index]
Copyright 2010- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Reader , Previous: Texinfo::Convert::Plaintext , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::TreeElement SYNOPSIS , Up: Texinfo::TreeElement [Contents][Index]
Texinfo::TreeElement - Texinfo tree element interface
Next: Texinfo::TreeElement NOTES , Previous: Texinfo::TreeElement NAME , Up: Texinfo::TreeElement [Contents][Index]
my $element = Texinfo::TreeElement::new({});
Next: Texinfo::TreeElement DESCRIPTION , Previous: Texinfo::TreeElement SYNOPSIS , Up: Texinfo::TreeElement [Contents][Index]
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.
Note that this module is not used in texi2any (except for the new method,
which is trivial and could be moved to another module).
Note that this module could be removed at any time.
Next: Texinfo::TreeElement METHODS , Previous: Texinfo::TreeElement NOTES , Up: Texinfo::TreeElement [Contents][Index]
Texinfo::TreeElement::new should be called on every Perl tree
elements created.
Texinfo::TreeElement defines accessors and methods for Texinfo tree elements
obtained from parsing Texinfo code. There is no specific advantage of using
the accessors, but they may be needed when some Texinfo modules XS interfaces
are used.
These accessors are not used in texi2any.
Next: Texinfo::TreeElement SEE ALSO , Previous: Texinfo::TreeElement DESCRIPTION , Up: Texinfo::TreeElement [Contents][Index]
Turns the $element_hash element hash into a Texinfo::TreeElement object.
This function is called on all the tree elements created in Texinfo modules
codes. Since no accessors are used in texi2any Texinfo modules,
the call to new is mainly cosmetic. It also allows to distinguish a
Texinfo tree element from a hash.
Return the $element type, or undef.
Return the $element command name, if defined, or undef.
Return the $element text if the element is a text element, or undef.
Return the number of children elements contained in $element.
Return the $element child element at index $index.
Return an array reference holding the elements contained in $element.
Return the parent element of $element.
Return the $element source info, or undef if there is none.
Return the $element $attribute_name attribute value. If the
$attribute_name does not exist or is not set at all, return undef.
Insert $added_element at the end of the $element contents (ie the element children array).
Up: Texinfo::TreeElement METHODS [Contents][Index]
Texinfo::TreeElement and XS extensions ¶ The Texinfo Perl modules can be setup to use Perl XS module extensions in
native code (written in C) that replace Perl package or methods by native code
for faster execution. It may be important to use the Texinfo::TreeElement
accessors that return elements instead of using hash keys described in
TEXINFO TREE when some Texinfo modules XS interfaces are
used.
The Texinfo modules XS interface is designed such that the Texinfo tree actually processed is not the Perl elements tree, but a tree stored in native code in XS extensions, corresponding to compiled C data structures. For some Texinfo modules XS extensions, Perl tree elements need to have a link from Perl to native code C data registered in the Perl element to find the C tree data corresponding to a Perl element.
Using the Texinfo::TreeElement methods may help setting up this link.
Indeed, if an element has already a link to C data,
the elements returned by Texinfo::TreeElement methods will also have
this link setup.
For example, if $element has already a link to C data, $element_child will also have a link to C data setup:
my $element_child = $element->get_child(0)
Note that, even if XS extensions are used, calling
new does not set up a link to C,
Texinfo::Example::TreeElementConverter new_tree_element should be used for that.
For other ways to setup this link, see Texinfo::Example::TreeElementConverter
and Texinfo::Reader and XS extensions.
Next: Texinfo::TreeElement AUTHOR , Previous: Texinfo::TreeElement METHODS , Up: Texinfo::TreeElement [Contents][Index]
Next: Texinfo::TreeElement COPYRIGHT AND LICENSE , Previous: Texinfo::TreeElement SEE ALSO , Up: Texinfo::TreeElement [Contents][Index]
Patrice Dumas.
Previous: Texinfo::TreeElement AUTHOR , Up: Texinfo::TreeElement [Contents][Index]
Copyright 2025- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Texinfo::Example::TreeElementConverter , Previous: Texinfo::TreeElement , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Reader SYNOPSIS , Up: Texinfo::Reader [Contents][Index]
Texinfo::Reader - Texinfo tree reader
Next: Texinfo::Reader NOTES , Previous: Texinfo::Reader NAME , Up: Texinfo::Reader [Contents][Index]
use Texinfo::Parser;
use Texinfo::Reader;
my $parser = Texinfo::Parser::parser();
my $document = $parser->parse_texi_file("somefile.texi");
my $start_element = $document->tree();
my $reader = Texinfo::Reader::new($start_element);
while (1) {
my $next = $reader->read();
last if (!defined($next));
my $category = $next->{'category'};
my $element = $next->{'element'};
if ($category == Texinfo::Reader->TXI_READ_TEXT) {
my $text = $element->{'text'};
....
} elsif ($category == Texinfo::Reader->TXI_READ_ELEMENT_START) {
my $cmdname = $element->{'cmdname'};
...
....
}
}
Next: Texinfo::Reader DESCRIPTION , Previous: Texinfo::Reader SYNOPSIS , Up: Texinfo::Reader [Contents][Index]
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.
Note that this module is not used in texi2any.
Note that this module could be removed at any time.
Next: Texinfo::Reader METHODS , Previous: Texinfo::Reader NOTES , Up: Texinfo::Reader [Contents][Index]
Texinfo::Reader offers an interface to a Texinfo tree obtained from
parsing Texinfo code. This interface is based on a stream of tokens associated
to tree elements. This interface is conceptually similar to the interface of
XML::LibXML::Reader or Pod::Simple::PullParser.
The Reader acts as a cursor going forward on the Texinfo tree and stopping
at each element on the way, providing with a new token. The user’s code keeps
control of the progress and simply calls the read() function repeatedly to
progress to the next token in the Texinfo document order. The other
function provides means for skipping sub-trees.
Next: Texinfo::Reader SEE ALSO , Previous: Texinfo::Reader DESCRIPTION , Up: Texinfo::Reader [Contents][Index]
Initialize a reader starting at the $element Texinfo tree element.
Returns the next token or undef at the end of the tree.
A token is an hash reference with string keys:
The current tree element.
Information on the tree element and on the position read. The possible token
category values are declared as constants and are accessed through
the Texinfo::Reader package, like
Texinfo::Reader->TXI_READ_ELEMENT_START.
The token category can take the following Texinfo::Reader constant values:
Start of the tree element, before getting the element contents.
End of the tree element after having read the contents (after a closing brace, an @end, at the end of a container).
Text element.
Text element supposed to be ignored, such as spaces appearing after an opening brace or around a comma delimiting arguments.
A tree element which is not a text tree element and does not hold content. For
Texinfo @-commands without braces nor line argument such as @@ and for empty
arguments. For example the brace_container argument container of @TeX{}
is empty. Also for invalid constructs such as brace @-commands without braces.
The Texinfo tree element is described in TEXINFO TREE.
Skip the remaining of the contents currently being processed. Return a token with the TXI_READ_ELEMENT_END category, or undef at the end of the tree.
If the $element optional argument is specified, a fatal error is emitted if it does not match with the parent element of the skipped contents.
Collect all the tree elements corresponding to @-command names in the $command_names array reference, starting at $element. The return value is an array reference of the collected elements, in the order of their appearence in the Texinfo tree.
Up: Texinfo::Reader METHODS [Contents][Index]
Texinfo::Reader and XS extensions ¶ The Texinfo Perl modules can be setup to use Perl XS module extensions
in native code (written in C) that replace Perl package or methods
by native code for faster execution. In general, using pure Perl or XS
extensions is transparent. This is not fully the case for Texinfo::Reader.
The XS interface is designed such that the Texinfo tree actually processed is
not the Perl elements tree, but a tree stored in native code in XS
extensions, corresponding to compiled C data structures.
If the Texinfo::Reader XS extension is used, the element used to
initialize the reader through
new
need to have a link from Perl to native code C data registered in the
Perl element to find the C tree data corresponding to the Perl element.
This is done automatically if the element is the Texinfo tree root element.
For other elements, this link may need to be setup especially.
To setup this link explicitly for the element associated to the current Reader token or the child elements of the current Reader token the following methods may be called:
Add a link from the current token Perl element to the associated C data.
Add a link from the Perl element to the associated C data for the child of the
current token Perl element at index $index. If the first child of the
current token Perl element is of type arguments_line, the child
of the arguments_line tree element is selected instead of the child
of the current token Perl element.
For example, to register all the elements upon reading them:
while (1) {
my $next = $reader->read();
last if (!defined($next));
my $element = $next->{'element'};
my $registerd_element = $reader->register_token_element();
if (!defined($element)) {
$element = $registerd_element;
}
...
}
Calling these two functions is not the only possibility to create a link from Perl to C data. Another possibility is to use the Texinfo::TreeElement interface to access other elements from elements with the link to C data already setup, or to use the Texinfo::Example::TreeElementConverter module methods.
Next: Texinfo::Reader AUTHOR , Previous: Texinfo::Reader METHODS , Up: Texinfo::Reader [Contents][Index]
Texinfo::Parser. Texinfo::Document. Texinfo::Example::TreeElementConverter.
Next: Texinfo::Reader COPYRIGHT AND LICENSE , Previous: Texinfo::Reader SEE ALSO , Up: Texinfo::Reader [Contents][Index]
Patrice Dumas.
Previous: Texinfo::Reader AUTHOR , Up: Texinfo::Reader [Contents][Index]
Copyright 2025- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Next: Index , Previous: Texinfo::Reader , Up: Texinfo modules documentation [Contents][Index]
Next: Texinfo::Example::TreeElementConverter SYNOPSIS , Up: Texinfo::Example::TreeElementConverter [Contents][Index]
Texinfo::Example::TreeElementConverter - Parent class for TreeElement based converters
Next: Texinfo::Example::TreeElementConverter NOTES , Previous: Texinfo::Example::TreeElementConverter NAME , Up: Texinfo::Example::TreeElementConverter [Contents][Index]
package Texinfo::Convert::MyConverter;
use Texinfo::Convert::Converter;
use Texinfo::Example::TreeElementConverter;
our @ISA = qw(Texinfo::Example::TreeElementConverter);
# define the methods needed for Texinfo::Convert::Converter
...
sub convert_tree($$) {
...
}
...
# end of Texinfo::Convert::MyConverter
my $converter = Texinfo::Convert::MyConverter->converter();
$converter->output($texinfo_parsed_document);
Next: Texinfo::Example::TreeElementConverter DESCRIPTION , Previous: Texinfo::Example::TreeElementConverter SYNOPSIS , Up: Texinfo::Example::TreeElementConverter [Contents][Index]
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.
Note that this module is not used in texi2any.
Note that this module could be removed at any time.
Next: Texinfo::Example::TreeElementConverter METHODS , Previous: Texinfo::Example::TreeElementConverter NOTES , Up: Texinfo::Example::TreeElementConverter [Contents][Index]
Texinfo::Example::TreeElementConverter is a super class that helps
using the Texinfo::TreeElement interface in converters. It provides
implementations of methods from other Texinfo Perl modules using the
TreeElement Texinfo::TreeElement interface only. The original
methods can be in the Texinfo::Convert::Converter, Texinfo::Common,
Texinfo::Convert::Utils and Texinfo::Structuring modules.
The Texinfo Perl modules can be setup to use Perl XS module extensions in
native code (written in C) that replace Perl package or methods by native code
for faster execution.
The Texinfo modules XS interface is designed such that the Texinfo tree
actually processed is not the Perl elements tree, but a tree stored in
native code in XS extensions, corresponding to compiled C data structures.
If XS extensions are loaded, finding a Perl element associated C data
is required in some cases, namely to initialize
Texinfo::Reader and XS extensions with XS
on an element (except for the tree root) or to find replaced substrings
elements in translations.
The Texinfo::Example::TreeElementConverter modules helps with
setting up the link from Perl elements to C, first by providing the
methods using the TreeElement interface
since the Texinfo::TreeElement interface automatically sets up this link.
The module also provides XS interfaces for methods also available in other
modules that setup the link from Perl elements to C. Lastly, some methods are
also available to create or access Texinfo tree elements that also setup
Texinfo elements with the link from Perl elements to C.
Using the Reader, the TreeElement interface and the methods provided in this module with XS to access and create elements also allows to go through the Texinfo tree without ever building full Perl element data. This may be all the more important that building full Perl element data wipes out the link from Perl elements to C element data.
Next: Texinfo::Example::TreeElementConverter SEE ALSO , Previous: Texinfo::Example::TreeElementConverter DESCRIPTION , Up: Texinfo::Example::TreeElementConverter [Contents][Index]
The following methods allow to create new elements and get elements. If XS extensions are used, elements should be created and accessed through these methods to have a link from Perl to C data setup for the created or returned element.
Create a new tree elements based on the $element hash reference. The $use_sv argument is optional; if set and XS is used, the $element hash reference is associated to the new tree element data in C, otherwise it is discarded.
Finds the index entry and index information associated to the tree element $element. See Texinfo::Common lookup_index_entry for a general description of the return values. Note that the returned $index_info information does not contain the index entries associated to the index, only some basic information on the index.
Returns the tree element or tree elements corresponding to the $command_name @-command with a link from Perl to C element data setup. Only for @-commands that could also be accessed through Texinfo::Document global_commands_information (if the link from Perl to C element data was not needed).
get_global_unique_tree_element should be called for @-commands that should
appear only once in a Texinfo document. This method returns the element.
global_commands_information_command_list requires a Texinfo::Document
$document argument. The $document could be available as
$converter->{'document'}. This method should be called for @-commands
that may appear more than once in a Texinfo document. This method returns
a reference on the array of all the $command_name @-command tree elements
appearing in the document.
The other methods are documented in the modules that provide the
non-TreeElement interface or the methods that do not setup elements with
link from Perl to C element data. The method name is either the same
as in this module, if the method is used as a wrapper around the method
with the same name, or can be obtained by removing a leading tree_element_.
For example, the index_content_element documentation can be used for the
tree_element_index_content_element method of this module.
Up: Texinfo::Example::TreeElementConverter METHODS [Contents][Index]
To associate sectioning commands and nodes tree elements Perl to C data, the
register_document_relations_lists_elements Texinfo::Document
method may be called after getting the tree before starting the tree
conversion, such that sectioning commands and nodes elements accessed through
nodes and section relations have the association to C data already setup:
$converter->{'document'}->register_document_relations_lists_elements()
If you use the Texinfo::Reader to go through the tree you can call
reader methods to associate Perl to C data based on the current element
being read, Texinfo::Reader register_token_element
and Texinfo::Reader register_token_element_child.
Next: Texinfo::Example::TreeElementConverter AUTHOR , Previous: Texinfo::Example::TreeElementConverter METHODS , Up: Texinfo::Example::TreeElementConverter [Contents][Index]
Texinfo::Convert::Converter, Texinfo::Common, Texinfo::Convert::Utils and Texinfo::Structuring.
Next: Texinfo::Example::TreeElementConverter COPYRIGHT AND LICENSE , Previous: Texinfo::Example::TreeElementConverter SEE ALSO , Up: Texinfo::Example::TreeElementConverter [Contents][Index]
Patrice Dumas, <bug-texinfo@gnu.org>
Previous: Texinfo::Example::TreeElementConverter AUTHOR , Up: Texinfo::Example::TreeElementConverter [Contents][Index]
Copyright 2011- Free Software Foundation, Inc. See the source file for all copyright years.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Previous: Texinfo::Example::TreeElementConverter , Up: Texinfo modules documentation [Contents][Index]
| Jump to: | %
A B C D E F G I L M N O P R S T U V W X |
|---|
| Jump to: | %
A B C D E F G I L M N O P R S T U V W X |
|---|