Texi2HTML – Texinfo to HTML v1.82: 7. Customizing HTML and text style in init files
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7. Customizing HTML and text style in init files

Some simple customization may be achieved with the redefinition of the variables associated with the command line options. For the description and an explanation of the meaning of these variables, Customizing the HTML and text style.

Other variables and hash entries can be modified in initialization file to achieve more customization. Lastly, functions references corresponding with functions called from the main program and initialization files may be redefined.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.1 Three contexts for expansions: preformatted, normal and string

There are three contexts of interest, one is the normal context, the other is a special context, called the preformatted context and the last is the string context. The preformatted context occurs when the spacing between words is kept. This is the case, for example, in @display or @example regions, and in menu comments (see section Menu formatting). The preformatted regions are usually rendered in <pre> elements in HTML. The string context occurs when rendering strings without formatting elements, in comments or titles for example.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.2 Three passes: macro expansion, document structure and output

There are three passes in texi2html. During pass 0, the @macro are expanded, in pass 1 the document structure is gathered and in pass 2 the result is output. In most cases you shouldn’t care about it, as almost all of the output customization is done in pass 2. Only if you want to do something before the pass 2 should you care.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.3 Customizing the formatting of commands without argument

This includes the commands whose name is a nonletter character like @@, the commands with lettered characters and braces but whose braces should be empty, like @TeX{}, or some commands associated with accentted letters like @AA{}. If there happens to be something within the braces, it is put after the command, thus

 
@TeX{something}

leads to the same than

 
@TeX{} something

Each of these categories of commands have three associated hashes, one for normal context, the other for preformatted context and the last in strings. The keys of the hashes are the command names, the associated value is the text replacing the command.

The hashes are:

command typenormal textpreformatted textstring
one nonlettered character %simple_map %simple_map_pre %simple_map_texi
nothing in braces %things_map %pre_map %texi_map

To change the HTML resulting from these constructs, just change the value. For example, if you want &shy; to be outputted for @- in normal and preformatted context, write in your init file:

 
$simple_map{'-'} = '&shy;';
$simple_map_pre{'-'} = '&shy;';

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.4 Punctuation commands

The formatting of a punctuation character followed by is determined by the hash %colon_command_punctuation_characters. If a command is preceded by a character in th is hash, it is replaced by the associated value. In the default case, the associated value is also the character, so this leave the punctuation character unmodified.

The following function reference may be redefined to handle characters that are in %colon_command_punctuation_characters:

Function Reference: $punctuation $colon_command $character

The $character is a character appearing in %colon_command_punctuation_characters and preceding a command. In the default case the associated value in %colon_command_punctuation_characters is returned.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5 Customizing accent, style and other simple commands

The formatting of the HTML produced by style and indicatric commands (@tt, @code, @email, @titlefont), the accentuation related commands taking argument (@', @udotaccent, @dotless) and miscalleneous commands (@email, @verb, @w, @uref, @math, @asis) is controlled by two hash in the default case, %style_map for normal context, %style_map_pre for preformatted context and %style_map_texi in string context.

The key of the hashes are the command names. There are two possibilities for the values corresponding with two interfaces. The values may be strings or hash references, and you can chose the interface depending on the one you prefer. The interface with hash reference is a bit more flexible but might also be regarded as more complex. If you don’t like either of these interfaces you can define your own.

Some remarks are in order:

  • The nonlettered accent commands which following character is considered to be the argument (like in @`a) should be keys of the hash %accent_map hash, even if no value is associated.
  • @math is handled differently if LaTeX2HTML is used.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.1 An interface for commands formatting with a hash reference

The key of the hashes are the command names. The value determine how the command argument is formatted. This value is a reference on a hash. In this hash each key corresponds with a type of information for the formatting, and the value is the corresponding information. For example, in

 
$style_map{'command'} = { 'args' => ['code'], 'attribute' => 'code'};

the arguments for @command are interpreted as specified by the values associated with the ‘args’ key while the attribute associated with that command is ‘code’.

The following keys in the hashes associated with each command have the following meaning:

args

The value associated is a reference on an array. Each element of the array defines how the arguments (separated by ‘,’ in the texinfo code) for the @-command should be formatted. The possibilities are

normal

for normal text,

code

for text with ‘---’, ‘--’, ‘''’ and ‘``’ kept as is,

keep

if the texinfo should be kept as is, without interpretation of the @-commands.

For example, we have

 
$style_map{'email'}->{'args'} = ['code', 'normal'];

because ‘---’, ‘--’, ‘''’ and ‘``’ should be kept as is in the first argument of @email.

The default is ‘['normal']’.

attribute

If the associated value is a word, it is considered to be an HTML element name, and the argument is enclosed between the element opening and the element closing. For example, if the value is elem, the resulting HTML is <elem>arg</elem>.

If the text is a word followed by some text, the word and is interpreted as above, and the text is considered to be the attributes text of the element. Thus elem class="elem" leads to <elem class="elem">arg</elem>.

This works only if there is only one argument.

begin

The associated value is added in front of the text.

begin

The associated value is added after the text.

quotes

If the corresponding value is true, the result is enclosed in quotes $OPEN_QUOTE_SYMBOL and $CLOSE_QUOTE_SYMBOL, with defaults ‘`’ and ‘'’.

function

The corresponding value should be a function reference. The corresponding function is called with the following arguments:

$command

The @-command name

$args

A reference on an array containing the arguments of the @-command.

$command_stack

A reference on an array containing the name of the @-commands containing the @-command being formatted, latest on top.

$state

A reference on a hash containing a lot of informations about the context of the @-command.

$line_nr

An opaque structure containing the information about the line number of the @-command. It can be used to call main::echo_error or main::echo_warning with first argument a message, and second argument $line_nr.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.2 An interface for commands formatting with a string

The keys of the hashes are the command names. The value determine how the command argument is formatted. If the value begins with ‘"’, the result is enclosed in quotes $OPEN_QUOTE_SYMBOL and $CLOSE_QUOTE_SYMBOL, with defaults ‘`’ and ‘'’.

The command argument is allready formatted as HTML. The remaining of the value text (or the value text if there were no ‘"’) is interpreted as follow:

  • If the text is empty the argument of the command is left as is.
  • If the text is a ‘&’ followed by a name, like ‘&function’, the name is considered to be a function name, and this function is called to format the argument of the command. The first argument of the function is the command name, the second is the command argument. For example, if the value associated with the (fictituous) command @foo is &my_func and we have:
     
    sub my_func
    {
        my @args = split /,\s*/ $_[1];
        return "$_[0]: $args[0]" if ($args[1] = 1);
        return "$args[0]";
    }
    

    The result of

     
    @foo{truc, 1}
    @foo{truc, bidule}
    

    will be

     
    foo: truc
    truc
    
  • If the text is a word, it is considered to be an HTML element name, and the argument is enclosed between the element opening and the element closing. For example, if the value is elem, the resulting HTML is <elem>arg</elem>. Similarly "quoted leads to `<quoted>arg</quoted>'.
  • If the text is a word followed by some text, the word and is interpreted as above, and the text is considered to be the attributes text of the element. Thus elem class="elem" leads to <elem class="elem">arg</elem>.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.5.3 Defining the style and indicatric commands interface

If you don’t like this scheme, it is possible to change how those commands are processed by redefining the following function reference:

Function Reference: $resulting_text style $style $command $text $args $no_close $no_open $line_nr $state $command_stack

$command is the @-command, $style is the value associated with the $command in the %style_map, %style_map_pre or %style_map_texi hashes. The $text is the text appearing within the @-command braces. args is a reference on an array contening the command arguments formatted according to the same conventions than with the reference hash style (provided the value associated with the @-command is a hash reference with a $arg key as described in Reference hash args). If $text is split in paragraphs each paragraph is passed through the function, and $no_close is true if it is not the last paragraph, while $no_open is true if it is not the first paragraph. $line_nr is an opaque structure containing the information about the line number of the @-command. It can be used to call main::echo_error or main::echo_warning with first argument a message, and second argument $line_nr. $state is a reference on a hash containing a lot of informations about the context of the @-command. $command_stack is a reference on an array containing the name of the @-commands containing the @-command being formatted.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.6 Formatting of special simple commands

The formatting of special simple commands is controlled by functions. To customize the output, the corresponding function references should be redefined. All these functions return a formatted text.

The formatting of anchors is controlled by $anchor_label.

Function Reference: $anchor_label anchor_label $identifier $anchor

$identifier is the anchor identifier, $anchoris the @anchor argument.

In the default case, it uses a function reference, $anchor that can do a reference target or link. It is especially relevant for HTML but can be used in other formats, it is a rather common element of different formats.

Function Reference: $anchor anchor $identifier $href $text $attributes

If $identifier is not empty, this value should be used to create a target for links (typically associated with a name or id attribute in HTML). The $href argument specifies a hpertextual reference which should be used to link to a target. In case both $identifier and $href are given the text produced should be both a target for $identifier and a link to $href. $text is the text to be displayed. $attributes are additional attributes. It should be reasonable to assume that the attributes are for a <a> HTML element.

To customize the images produced by @image, the first possibility is to modify the @IMAGE_EXTENSIONS, which holds a list of filename extensions for image files. It is also possible to redefine the function used to determine the filename of the image:

Warning: This description is wrong. The API is still moving, so don’t count on it.

Function Reference: $filename image_files $basename $extension

$basename is the first @image argument, $extension is the corresponding @image argument. This function reference should return an array of image filenames without path that the main program should look for.

Last, it is possible to control the formatting of @image by redefining:

Function Reference: $image image $file_path $basename $preformatted $file_name $alt_text $width $height $raw_alt $extension $working_dir $file_relative_path

$file_path is the image file name with the path from the output directory to the source manual directory prepended, $basename the file name without extension (the first @image argument). $preformatted is true if the image appears in preformatted text. $file_name is the file name without path but with extension. $alt_text is the alternate text, it may be undefined. $width and $height are the corresponding arguments of @image, $raw_alt is the unmodified alt argument of @image and $extension holds the corresponding @image argument. $working_dir is the path to working dir relative to the output directory. $file_relative_path is the file name relative to the $working_dir.

The formatting of @sp is controlled by:

Function Reference: $sp sp $number $preformatted

$number is the numeric argument of @sp. $preformatted is true if the @sp appears in preformatted text.

The formatting of @acronym and @abbr is controlled by:

Function Reference: $acronym acronym_like $acronym_texi $acronym_text $with_explanation \@explanation_lines $explanation_text $explanation_simply_formatted

$acronym_texi is the acronym argument with texinfo @-commands, $acronym_text is formatted.

The other arguments are related with the explanation, the second arg of the acronym. $with_explanation is true if the second argument of the acronym command is present. If an explanation exists, coming from previous @acronym or as an arg of this command, the other args are defined: \@explanation_lines is a reference on an array containing the simply fomatted explanation lines, $explanation_text is the explanation text formatted, $explanation_simply_formatted is the explanation with a light formatting, unabling in HTML (or XML) the explanation to be in an attribute.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.7 Processing special characters in text

Some characters are processed especially in text: ‘---’, ‘--’, ‘``’ and ‘''’. This is done only if in normal text and not in some commands (@code, @env…). A function reference is called to process the text and should take care of those constructs. It may also be used to transform the text, for example set it in upper case if it is in @sc. This function should also take care of protecting special characters

Function Reference: $processed_text normal_text $text $in_raw_text $in_preformatted $in_code $in_simple $command_stack

The function processes $text and returns $processed_text. The other arguments give some information about the context of the text. $in_raw_text is true if the text appears in special place where there is no formatting, typically in comments. $in_preformatted is true if in a preformatted environemnt, and $in_code is true if in a special command like @code, @env where ‘---’, ‘--’, ‘``’ and ‘''’ should not be touched. $in_simple is true if in string context. $command_stack is an array containing the name of the formatting @-command that enclose the text.

In the default case the ‘---’, ‘--’, ‘``’ and ‘''’ constructs are expanded if needed and the text is upper-cased if in @sc. Special characters (‘&’, ‘"’, ‘<’ and ‘>’ in HTML) are protected if needed.

Some characters are special, for example we have ‘&’, ‘"’, ‘<’ and ‘>’ in HTML. In some cases some pieces of text don’t go through the above function, but still needs to be protected to appear in text. This is done by the function associated with the function reference

Function Reference: $protected_text protect_text $text

The function processes the unprotected text $text and returns the resulting protected text $protected_text.

Empty lines are processed by the following function reference, which could be usefull if empty lines are to be removed for example

Function Reference: $resulting_text empty_line $empty_line $state

This function processes an $empty_line and returns the resulting text $resulting_text. $state is a structure that holds informations about the state of the parsing. Empty lines are left as is by default except right after a definition @-command.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.8 Customizing strings written by texi2html

texi2html writes some strings in the generated document at various places, at the page footers, on the help page, for special section headings, buttons alt text and so on. These strings are customizable. The string chosen depends on the language of the document (set by --document-language’, $LANG or @documentlanguage). This is the basis for internationalization as it allows for strings translations.

The strings are found in a hash reference, $LANGUAGES. Each key is a language code. The associated value is also a hash reference. The key is an english string and the associated value is the string replacing the english string, if present. For example, we have

 
$LANGUAGES->{'fr'} = {
              ' Up ' => 'Plus haut',
};

It means that whenever the string ‘ Up ’ is to be written and the language is ‘fr’, ‘Plus haut’ is written. It is possible to customize the english strings by redefining the ‘en’ language hash.

When a string contains a ‘%’ followed by ‘{name}’ it means that the string will be expanded by texi2html. For example, if we have

 
$LANGUAGES->{'fr'} = {
              'See %{node_file_href}' => 'Voir %{node_file_href}',
};

%{node_file_href}’ will be expanded to an href for a node in a file by texi2html in the string. A ‘%%’ will be expanded as ‘%’.

When a @documentlanguage appears in the document and the language wasn’t set on the command line, it may be convenient for the user to redefine some variables based on the new language. There is a function reference that may be used for that, it is called each time a @documentlanguage is encountered:

Function Reference: $translate_names

This function is called each time @documentlanguage is encountered and the language wasn’t seet on the command line. It should be used to retranslate some strings based on the new language.

For more on internationalization, see Internationalization.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.9 References


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.9.1 Reference to external manual

The references are produced with two function references, one for the hypertextual reference construction, the other for the full reference to external manual.

Function Reference: $href external_href $node $node_identifier $xml_node_identifier $manual_file_name

$node is the node name, with @-commands. $node_identifer is the node name mapped to an identifier acceptable as a file name. $xml_node_identifier is the node name mapped to an identifier acceptable as an XML identifier. Those identifiers are built as explained in (texinfo)HTML Xref section ‘HTML Xref’ in GNU Texinfo, thus allowing for cross references to external manuals. $file is the manual or file name of the external reference. This function should return an href leading to the external manual.

The default for this function is to make a reference compatible with makeinfo (see (texinfo)HTML Xref section ‘HTML Xref’ in GNU Texinfo).

Function Reference: $text external_ref $command $section $book $node_and_file $href $cross_ref_name \@args_texi \@formatted_args

This function formats a reference to an external texinfo manual. The $command is the ref command (ref, xref or pxref, in text, at sentence beginning or in parenthesis). The optionnal $section argument is the section in the book and book is the book title. $node_and_file is the node and file name formatted according to the convention used in info: ‘(file)node’. $href it an hypertextual reference to the distant manual constructed using the above function. $cross_ref_name is an optionnal cross reference name appearing in the reference command. \@args_texi is a reference on an array containing the @-command arguments, not formatted, with \@formatted_args contains the formatted @-command arguments. This function returns the text corresponding with the external html manual reference. This function returns the full formatted text of the external reference.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.9.2 Reference to an internal node

A function reference is available for internal references.

Function Reference: $text internal_ref $command $href $short_name $name $is_section \@args_texi \@formatted_args

This function formats a reference to a node in the current manual. The $command is the ref command (ref, xref or pxref, in text, at sentence beginning or in parenthesis). $href it an hypertextual reference linking to the corresponding node or section. $short_name and $name hold the text for the reference but $short_name can be the node name which is assumed to be shorter than the section name. $is_section is a boolean true if the reference is a reference to a section. \@args_texi is a reference on an array containing the @-command arguments, not formatted, with \@formatted_args contains the formatted @-command arguments. This function returns the full formatted text of the internal reference.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.10 Commands used for centering and flushing of text

When a command controlling the alignement of text is used (@center, @flushleft and @flushright), the main program takes care of opening and closing paragraphs. The alignement commands are the key of the %paragraph_style hash. The value is used in the function doing the formatting of the paragraphs. See section Formatting (or not) a paragraph and a preformatted region.

A function references allows for a customization of the formatting of the text appearing in the command block.

Function Reference: $result paragraph_style_command $command $text

$command is the command name, $text is the text appearing within the command. This function returns a formatted text. The default is to return the text unmodified.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.11 Formatting (or not) a paragraph and a preformatted region


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.11.1 Paragraph and preformatted region formatting

The formatting of a paragraph region or a preformatted region, is controlled by function references:

Function Reference: $paragraph_text paragraph $text $alignement $index $formatting_command $formatting_command_formatted \$paragraph_number $format $item_number $enumerate_style $number $command_stack_at_end $command_stack_at_begin

This function formats a paragraph. $text is the text of the paragraph, $alignement is the empty string when no alignement command has been seen, otherwise it is the current alignement command name. See section Commands used for centering and flushing of text. $indent holds ‘noindent’ or ‘indent’ if the corresponding @-command appeared in the paragraph. $command_stack_at_end and $command_stack_at_begin are arrays containing the opened @-commands at end and at beginning of the paragraph, latest on top.

The remaining arguments are usefull when the paragraph appears within a list or table. It is usefull whenever the paragraph has to be formatted differently when appearing in such environments. Moreover in that case the format command (@itemize…) may have an associated formatting command. $formatting_command is this formatting command (like @minus). $formatting_command_formatted is the command formatted in html in case the formatting command is a leading command (like @minus) which should be leading the first paragraph. \$paragraph_number is a reference on the number of paragraphs in that format command. The corresponding variable should be increased when a paragraph is added. $format is the format command. See section Formatting individual table and list items.

If the $format is an enumerate, $item_number is the number of the item in the list, $enumerate_style is the argument of the enumerate, $number is the number or letter corresponding with this item.

Function Reference: $preformatted_text preformatted $text $style $region_name $formatting_command $formatting_command_formatted \$preformatted_number $format $item_number $enumerate_style $number $command_stack_at_end $command_stack_at_begin

This function formats a preformatted region. $text is the text of the preformatted region, $style is the css style associated with that preformatted region (see section Customizing the texi2html css lines). $region_name is the name of the command opening the preformatted region (example…, see Formatting of complex formats (@example, @display…)) or a identifier for the preformatted context (for example menu-comment, see Menu formatting). The alignment commands are not taken into account, as the spaces are preserved in preformatted regions, you should flush and center by hand. $command_stack_at_end and $command_stack_at_begin are arrays containing the opened @-commands at end and at beginning of the preformatted region, latest on top.

The remaining arguments are usefull when the preformatted region appears within a list or table. It is usefull whenever the preformatted region has to be formatted differently when appearing in such environments. Moreover in that case the format command (@itemize…) may have an associated formatting command. $formatting_command is this formatting command (like @minus). $formatting_command_formatted is the command formatted in html in case the formatting command is a leading command (like @minus) which should be leading the first preformatted region. \$preformatted_number is a reference on the number of preformatted regions in that format command. The corresponding variable should be increased when a preformatted region is added. $format is the format command. See section Formatting individual table and list items.

If the $format is an enumerate, $item_number is the number of the item in the list, $enumerate_style is the argument of the enumerate, $number is the number or letter corresponding with this item.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.11.2 Avoiding paragraphs in formats

It is possible to avoid that a format closes the previous paragraph or preformatted region and reopens one, by putting the format command in a hash, %format_in_paragraph with a true value. This only makes sense for few commands since otherwise the nesting of formats and paragraphs could become wrong.

If the value of %no_paragraph_commands associated with a command is true, no paragraph is started by the command if outside of a paragraph (after an empty line, for example). If the value is set to 0, it will start a paragraph. If the value is not set, reasonable defaults are set.

It is also possible to stop a paragraph when an @-command happens by putting the @-command in the %stop_paragraph_command hash associated with a true value.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.12 Formatting of complex formats (@example, @display…)

Here we see how a whole complex format is formatted. For the formatting of the text, see Formatting (or not) a paragraph and a preformatted region.

The formatting of the complex formats is ultimately controlled by a function, however the default for this function uses a hash reference and changing the hash reference values should be enough in most cases. This hash reference is called $complex_format_map. It has a key for each of the complex format commands (example, smallexample, lisp, smalllisp, display, smalldisplay, format, smallformat).

The associated value is also a reference on a hash. The keys are:

begin

An eval of begin should lead to the beginning of the formatted HTML.

end

An eval of end should lead to the end of the formatted HTML.

class

The HTML class. If not defined, the command name.

pre_style

The preformatted style. If not defined the corresponding CSS style is used.

style

If the associated value is code, the format is assumed to be in code style, where with ‘---’, ‘--’, ‘''’ and ‘``’ kept as is. If the key is absent the format inherits the code style and the font from the enclosing context.

The enclosed text will be formatted as described in Formatting (or not) a paragraph and a preformatted region, and the name of the complex format will be available to the function formatting the text.

If you aren’t satisfied with this scheme, you can redefine the following function reference for a better control over the complex format formatting:

Function Reference: $complex_format_text complex_format $format_name $preformatted_text

$format_name is the complex format name, $preformatted_text is the text allready formatted as described in Formatting (or not) a paragraph and a preformatted region. This function returns the whole complex format.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.13 Customizing the formatting of lists and tables

The formatting of lists and tables is done at two levels:

  • At the level of the whole region (table or list),
  • At the level of the individual items, rows or cells of the list or table.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.13.1 Formatting individual table and list items

In texinfo it is possible to give @itemize or table command (hereafter called a format command) a formatting command. For example @minus is the formatting command here:

 
@table @minus

The default is to apply the command to the text item, however it is possible to avoid it. The hash %special_list_commands has an entry for each of the format command. Each of these entries is a hash reference. If a formatting command is a key of the hash reference, then the formatting command is not applied to the text item for that format command. For example, if we have:

 
$special_list_commands{'itemize'} = { 'bullet' => '' };

and we have the following @itemize:

 
@itemize @bullet
@item an item
@end itemize

then @bullet will not be applied to an item.

More control of the text before formatting of the line or the item is achieved with the following function reference:

Function Reference: ( $result_line, $open_command) format_list_item_texi $format $line $prepended $command

The $format is the list or table @-command, $line is the item line, $command is the format command, $prepended is set to the text folllowing the format command on the format argumlent line. The $result_line replaces the item argument, and if $open_command is true, the format command is opened for the line.

lists

The items of lists are formatted using the following function reference:

Function Reference: $list_item list_item $text $format $command $formatted_command $item_number $enumerate_style $number $prepended_texi $prepended_formatted

This function formats the text between @item commands. $text is the text corresponding with the item. $format is the type of format, ‘itemize’ or ‘enumerate’. $command is the formatting command given in argument to @itemize, $formatted_command is this command formatted if it is a leading command, like @minus.

If the $format is an enumerate, $item_number is the number of the item in the list, $enumerate_style is the argument of the enumerate, $number is the number or letter corresponding with this item.

If the $format is an itemize, $prepended_texi is the text that appeared on the itemize line, maybe after the formatting command (if any), and $prepended_formatted is the corresponding text, formatted.

two column tables

The two columns tables (@table, @ftable and @vtable), items are formatted using two function references, one for the first line located on the @item line corresponding with the first column, the other for the text appearing on the following lines, corresponding with the second column text.

Function Reference: $table_item table_item $item_text $index_label_text $format $command $formatted_command $command_stack $text_formatted $text_formatted_leading_spaces $text_formatted_trailing_spaces $item_command

This function is used to format the text on the @item line. $text_item is the text line. In case there is an index entry associated with the @item (as with @ftable and @vtable), $index_label_text is the text inserted at the place where an index entry appears. See section Formatting of index entries. $format is the type of format, ‘table’, ‘ftable’ or ‘vtable’. $command is the formatting command given in argument to the table format command, $formatted_command is this command formatted if it is a leading command, like @minus. $command_stack is an array with all the @-commands opened, latest on top. $text_formatted is the text formatted by the formatting command if the command is a command with braces like @code. $text_formatted_leading_spaces and $text_formatted_trailing_spaces are the spaces removed before closing the format. $item_command is the item command, ‘@item’ or ‘@itemx’.

Function Reference: $table_line table_line $text

This function is used to format the text on the lines following the @item line. $text is the corresponding text.

multitable

The multitable elements formatting is controlled by the functions associated with two function references. One for a cell, and the other for a row.

Function Reference: $multitable_cell cell $text $item_command \@columnfractions \@prototype_row \@prototype_lengths $column_number

This function is used to format the text of a multitable cell, the text following a @item or a @tab. $text is the corresponding text. $item_command is the command used to introduce the row, such that it is possible to distinguish between @item and @headitem. \@columnfractions is a reference on an array containing the @columnfraction arguments, if any, and \@prototype_row is a reference on an array containing the row prototypes given on the @multitable line, if any. \@prototype_lengths array contains the lengths of the row prototypes formatted. $column_number is the maximal number of columns.

Function Reference: $multitable_row row $text $item_command \@columnfractions \@prototype_row \@prototype_lengths $column_number

This function is used to format a multitable row. $text is the row text, with cells allready formatted with the $cell function reference. $item_command, \@columnfractions, \@prototype_row, \@prototype_lengths and $column_number are the same than in the function reference above.

In the default case, this function is interlinked with $begin_format_texi (see section Customizing format opening) and @multitable formatting since a stack of possible nested multitables is kept to know the cell number.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.13.2 Formatting of a whole table or list

If the Texinfo command is a key of the %format_map, the associated value is used to specify the formatting of the construct, otherwise a function is called. The value in %format_map associated with a command is interpreted similarly with values associated with more simpler commands:

  • If the text is a word, it is considered to be an HTML element name, and the whole table or list is enclosed between the element opening and the element closing.
  • If the text is a word followed by some text, the word and is interpreted as above, and the text is considered to be the attributes text of the element.
  • If the text is empty nothing is added to the text.

In case the %format_map isn’t used, a function reference called $table_list should be redefined, the associated function will be called each time a command isn’t found in %format_map.

Function Reference: $whole_table_list table_list $format_command $text $command $formatted_command $item_nr $enumerate_style $prepended_texi $prepended_formatted \@columnfractions \@prototype_row \@prototype_lengths $column_number

$format_command is the Texinfo command name, $text is the formatted items. $command is the format command given in argument to the format command, $formatted_command is the same, but formatted. $prepended_texi is the remaining text on the format command line, $prepended_formatted is the same, but formatted. Only relevant in @enumerate, $item_nr is the item number, and $enumerate_style is the @enumerate style. Only relevant in @multitable \@columnfractions is a reference on an array containing the @columnfraction arguments, if any, \@prototype_row is a reference on an array containing the row prototypes given on the @multitable line, if any, \@prototype_lengths array contains the lengths of the row prototypes formatted and $column_number is the maximal number of columns.

If you still want to use %format_map but differently from the default, it is possible to redefine the following function reference:

Function Reference: $whole_table_list format $command $format $text

$command is the @-command, $format is the entry associated with $command in %format_map. $text is the formatted items.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.14 Definition commands formatting

The formatting of definition commands is controlled by a main hash, 3 strings and another hash, and and five functions. The mainhash describes how the text on the definition line is interpreted, the functions control the formatting of the definition line and the definition function text.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.14.1 Customizing the interpretation of a definition line

The keys of the hash %def_map are definition command names. There are two types of entries:

  • If the command is a shortcut for another definition command the value is a text and the definition command is replaced by the text.

    For example if we have:

     
    $def_map{'deftruc'} = '@defvr {A truc}';
    

    and a line like

     
    @deftruc var
    

    the line will be transformed in

     
    @defvr {A truc} var
    
  • If the command isn’t a shortcut, it is associated with an array reference. The first element is ‘f’, ‘v’ or ‘t’ corresponding with the index type (‘f’ for function, ‘v’ for variable, ‘t’ for type).

    The remaining of the array describes how to interpret the text following the definition command on the definition command line. The entry item specify what corresponds with the next bracketed item or word. Currently the possibilities are ‘category’, ‘name’, ‘type’, ‘class’, ‘arg’ and ‘argtype’. ‘arg’ means that the arguments are not mixed with type definitions, with ‘argtype’ types are mixed with definitions. When there is no ‘arg’ nor ‘argtype’ it is the same than ‘argtype’ (like makeinfo).

    For example if we have

     
    def_map{'defvr'} = [ 'v', 'category', 'name' ];
    

    The first bracketed item following @defvr is considered to be the category and the next one is the name. The index associated with the definition line is the variables index.

Some characters are special with regard with definition parsing, they are delimiters, the can have a role in definition argument determination, and also hae a special meaning in arguments parsing. This is not very well documented in the texinfo manual, so it is subject to change. Strings allow to determine the delimiters:

$def_argument_separator_delimiters

Characters that separate arguments, currently ()[],.

$def_always_delimiters

Character that are always delimiters, if they appear in a type or a parameter, ()[].

$def_in_type_delimiters

Character that are considered as delimiters only if in a type. In a parameter they are part of the parameter.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.14.2 Customization of the definition formatting

Five functions are used when formatting a definition command:

category name
Function Reference: $category definition_category $category $class $style $command

This function precise a category name associating a class $class (if given) with $category. The $style of the definition may be ‘f’, for function, ‘v’, for variable or ‘t’, for type. The $command is the definition @-command.

Function Reference: $entry definition_index_entry $name $class $style $command

This function precise a name associating a class $class (if given) with $name. This is used to do an index enntry associated with th edefinition command. The $style of the definition may be ‘f’, for function, ‘v’, for variable or ‘t’, for type. The $command is the definition @-command.

formatting of the definition line
Function Reference: $line def_line $class_category_class $name $type $arguments $index_label \@arguments_array \@arguments_type_array \@unformatted_arguments_array $command $class_name $category $class $style $original_command

This function formats the definition line. $class_category is the category formatted with $definition_category, $name, $type and arguments are the element of the definition line. $index_label is the text inserted at the place where an index entry appears. See section Formatting of index entries. \@arguments_array is an array holding the definition arguments, formatted. \@arguments_type_array holds the type of the definition arguments, like ‘name’, ‘type’ and similar arguments, ‘paramtype’. ‘delimiter’ and ‘param’. \@unformatted_arguments_array holds the arguments without @-command substitution. $command is the definition command, after substitution. $class_name is the class applied on name, formatted as specified in definition_index_entry. $category and $class are the corresponding arguments. $style corresponds with the index style, as explained above. $original_command is the unmodified definition @-command.

definition text
Function Reference: $definition_text def_item $text

This function formats the definition text, $text.

the whole definition
Function Reference: $definition def $text

This function formats the whole definition. The definition line and text formatted by the above functions are in $text.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.15 Customizing headings formatting

A function controls the formatting of sectioning element headings, with the corresponding function reference:

Function Reference: $heading_text heading \%element_reference

The \%element_reference is a reference on a hash corresponding with the sectioning element. The following keys are of interest:

text

The heading text

name

The heading text without section number

node

true if the sectioning element is a node without associated structuring command

level

The level of the element in the document tree. ‘0’ is for @top, ‘1’ for @chapter and so on

tag_level

the sectioning element name, with @raisesections and @lowersections taken into account

top

true if it is the top element

It is also possible to customize the heading text with section number with the following function reference (called for headings and nodes):

Function Reference: $result_texi heading_texi $heading_command $heading $number

$heading_command is the sectioning @-command of that heading. $heading is the texinfo for that heading. $number is the heading number classicaly computed with dots between numbers, and letters for top level appendix numbering. This function should return the texinfo text corresponding with the numbered heading.

The label associated with the heading that can appear before the heading itself and even before the navigation panel is customized with the following function reference:

Function Reference: $element_label element_label $identifier \%element_reference $command $unformatted_line

$identifier is the identifier associated with the heading. \%element_reference is the same as above. $command is the @-command appearing on the line, and $unformatted_line is the line, unformatted.

Additionally, for @node and sectionning @-commands the formatting of the label, navigation panel and heading is controlled by:

Function Reference: $element_heagin_text element_heading \%element_reference $command $command_texi_arg $formatted_arg $in_preformatted $one_section $element_heading $first_in_page $is_top $previous_is_top $unformatted_line $element_id $new_element

\%element_reference is the same as above. $command is the heading @-command. $command_texi_arg is the argument of the @-command, unformatted. $formatted_arg is is the argument of the @-command, formatted. $in_preformatted is true if in preformatted environment. $one_section is true if there is only one section. $first_in_page is true if this is the first heading in a page. $is_top is true if the heading is considered as a top element heading. $previous_is_top is true if the previous helement was a top element. $unformatted_line holds the whole line, unformatted. $element_id is the id of the heading. $new_element is true if the heading is the first of an element block.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.16 Formatting of special regions (@verbatim, @cartouche, @quotation)

Regions corresponding with raw text, like @verbatim, @html or @tex are formatted according to the following function reference:

Function Reference: $raw_region raw $command $text

$command is the command name, $text is the raw text.

If LaTeX2HTML is used, @tex regions are handled differently, (see section Bypassing normal formatting).

The @cartouche command formatting is controlled by the function reference:

Function Reference: $cartouche cartouche $text

$text is the text appearing within the cartouche.

The formatting of @quotation and @smallquotation is controlled by two function references. The first one is usefull in case the @quotation has an argument, as it allows to prepend a string to the quotation text:

Function Reference: $prepended_string quotation_prepend_text $command $text

$command is the @-command. $text is the argument of the quotation with @-commands not interpreted. This function can return a string which will be prepended to the quotation text.

The whole quotation is formatted by:

Function Reference: $quotation quotation $command $quotation_text $argument_text $argument_text_texi

$command is the @-command. $quotation_text is the quotation text, formatted, with the text prepended by the function above. $argument_text is the argument of the @quotation, formatted. $argument_text_texi is the argument of the @quotation, simply formatted.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.17 Menu formatting

There are two possibilities for menu formatting:

The simple formatting in a preformatted is used if $SIMPLE_MENU is true, otherwise the format with tables is used (this is the default).

If $USE_ACCESSKEY is set, the accesskey attribute is used in anchors. In that case the %BUTTONS_ACCESSKEY hash is used for the access key.

To understand how the formatting of menus is controlled, the different parts of a menu are first described, then how to control the formatting of each of these parts, for each possible formatting.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.17.1 The structure of a menu

In texi2html, a menu is considered to be composed of 2 parts, the menu entries and the menu comments. Menu entries are further divided in an entry link and optionnaly an entry description. The entry link consists in a node name and an optionnal menu entry name.

A menu entry begins with ‘*’ at the beginning of the line. It begins with the entry link, followed by the description. The description spans until the next menu entry, or an empty line not contained within a command block which begun in the description. An empty line or starts a menu comment, which spans until the next menu entry.

Here is an illustration of these rules:

 
@menu
* entry name: node name.        description begins
   description continues
* another menu entry::
   description begins
                    description continues

   A menu comment, after an empty line

* node::                        description begins
still in description.

* last entry::         description begins @emph{text

of the description, even if there is an empty line,
because we are in @emph}.
@end menu

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.17.2 The formatting of the different menu components

If in a preformatted context (and $SIMPLE_MENU isn’t set), the menu link and description are put in the same preformatted environment. This can be avoided with $SEPARATE_DESCRIPTION.

Two function references are associated with the formatting of the different parts of a menu:

Function Reference: $link menu_link $section \%state $href $node $name $ending $has_name $command_stack $preformatted

$section is the section name corresponding with the link, $href is the link hypertextual reference. $href may be absent. \%state holds informations about the current context. $node is the node name, $name is the name of the node. $ending is the text ending the link entry, in general ‘::’ followed by some spaces. $has_name is true if the entry has an explicit name, otherwise $name has been constructed using the formatted node name. $command_stack is an array containing the commands enclosing the menu link. It is used in the default case to detect if the menu link is right in the @menu or not, since if it is not right below the menu the formatting is simpler. $preformatted is true if in preformatted context. See section Three contexts for expansions: preformatted, normal and string.

This command is not called if $SIMPLE_MENU is set.

Function Reference: $description menu_description $description_text \%state $element_text

$description_text is the text of the menu description. The formatted link is also here if in preformatted context and $SEPARATE_DESCRIPTION is not set. \%state should be used similarly than for the menu link. $element_text is the heading of the element associated with the node. $command_stack and $preformatted are the same than for the menu link.

The menu comment part is formatted like a normal command, called menu_comment. It is only used if not in preformatted environment and if just below a @menu since otherwise one cannot tell if it is a menu commment or normal text. The default is to have it be formatted like a Formatting of complex formats (@example, @display…), with

 
$complex_format_map->{'menu_comment'} =
{
   'begin' => q{"<tr><th colspan=\"3\" align=\"left\" valign=\"top\">"},
   'end' => q{"</th></tr>"}, 'pre_style' => "$MENU_PRE_STYLE", 'class' => 'menu-comment',
}

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.17.3 Simple menu formatting in a preformatted environment

If the menu is to be formatted in a single preformatted environment, an entry for ‘menu’ and ‘detailmenu’ should be added to the $complex_format_map hash reference (see section Formatting of complex formats (@example, @display…)). In the default case, if the user didn’t add an entry himself, a very simple entry is used, with:

 
$complex_format_map->{'menu'} = { 'begin' => q{''} , 'end' => q{''},
    'pre_style' => "$MENU_PRE_STYLE", 'class' => 'menu-preformatted' };

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.17.4 The formatting of the menu in a table

In the default case, the name of the section corresponding with the node is used instead of the node name. If $NODE_NAME_IN_MENU is true, however, node names are used. If $AVOID_MENU_REDUNDANCY is true and menu entry equal menu description the description isn’t printed. This is the default. Likewise, if node or section name equal entry name, do not print entry name.

A symbol, $MENU_SYMBOL is put at the beginning of menu entries when the node name is used. The default is ‘&bull;’. If $UNNUMBERED_SYMBOL_IN_MENU is true it is also put at the beginning of unnumbered section names. This is not done by default.

The menu comments are considered to be preformatted text. The style associated with this preformatted text is determined by $MENU_PRE_STYLE. Default is ‘font-family: serif’. The entry similar with an entry in $complex_format_map (see section Formatting of complex formats (@example, @display…)) used when the menu appears in a preformatted enviroment is in $MENU_PRE_COMPLEX_FORMAT, and, in the default case is:

 
$MENU_PRE_COMPLEX_FORMAT = {
              'pre_style' => $MENU_PRE_STYLE, 
              'class' => 'menu-preformatted'
   };

The css class associated with menu comments is menu-comments.

The following function reference controls the formatting of a wole menu or a detailmenu in that case:

Function Reference: $menu menu_command $command $menu_components_text

$command is the menu command, currently ‘menu’ or ‘detailmenu’. $menu_components_text is the formatted menu components text, obtained as explained above.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.18 Indices formatting

Two different things needs to be handled for indices formatting, the place where the index term appears, the index entry, and the index list itself. The indexing commands like @cindex determines where index entries appear, and the index list is printed with a @printindex command.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.18.1 Formatting of index entries

Index entry places in the main text may be the target for hypertext references. Their formatting is controlled by the function associated with the following function reference:

Function Reference: $target index_entry_label $identifier $preformatted $entry $index_name $index_command $texi_entry $formatted_entry

$identifier should be used to create a target for links (typically associated with a name or id attribute in HTML). $preformatted is true if the index entry appeared in preformatted text. $entry is the index entry with all the @-commands removed. $index_name is the index name, $command is the index command which may be a index command like @cindex, but also a definition or a table. $texi_entry is th eindex entry with @-commands, and $formatted_entry the entry formatted.

Regular index entries are (like @cindex) are formatted using the following function reference:

Function Reference: $index_entry index_entry_command $command $index_name $label $entry_texi $entry_formatted

$command, $index_name, $entry_texi and $entry_formatted are the same as above, and $label is what could be used as a label, formatted using the function above.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.18.2 Customizing the formatting of index lists

There is an elaborate default index formatting in texi2html, with index summary by letter linking to index entries grouped by letters too, with the possibility of index pages split accross files. This system may be completly bypassed by redefining the function reference that is called when @printindex is encountered:

Function Reference: $index_text printindex $index_name

$index_name is the index name appearing on the @printindex line. The index formatted should be returned by this function reference.

If the default index formatting is used, there are still possibilities to customize part of the formatting. The index entries are sorted alphabetically. A whole index list is considered to be composed of letter entries. A letter entry is composed by all the index entries beginning with that letter. A letter may be a non alphabetical character, but we call it letter here.

An index summary appears at the beginning and at the end of an index list, and should be used to jump directly to a letter entry. Indices lists may be split across pages, thus the different letters may appear on different files. The number of index entries appearing on each page is determined by a variable $SPLIT_INDEX if set. The default is to split indices after 100 entries.

The formatting of all these elements is controlled by the following function references:

formatting of a letter in a summary
Function Reference: $letter summary_letter $letter $file $identifier

This function is used to format a letter appearing in a summary, refering to a letter entry in the index list. $letter is the letter. $file is the file name where the letter entry appears. More precisely, it is empty when the letter entry is on the same page than the summary, it contains the file name when the index page is split accross page. $identifier is an identifier for the target letter entry.

formatting of a summary
Function Reference: $summary index_summary \@alphabetical_letters \@nonalphabetical_letters

\@alphabetical_letters and \@nonalphabetical_letters contain the formatted summary letters, formatted with the above function.

formatting of an index entry
Function Reference: $entry index_entry $entry_href $entry_text $section_href $section_heading

$entry_href is a reference to the place where the index entry appeared, $entry_text is the corresponding text. $section_href is a reference to the beginning of the sectioning element containing the index entry, $section_heading is the heading of the element.

formatting of letter entry
Function Reference: $letter_entry index_letter $letter $identifier $index_entries_text

This function formats a letter entry, consisting in all the index entries beginning with this letter. $letter is the letter, $identifier should be used to create a target for links (typically links from summaries), and $index_entries_text is the text of the index entries formatted as described above.

formatting of whole index
Function Reference: $index print_index $index_text $index_name

$index_text is the text of all the index entries grouped by letter appearing in that page formatted as above. It is undef if there are no entries or theindex name isn’t known. index_name is the name of the index, the argument of @printindex.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.19 Floats and lists of floats

Floats appear in the @float environment, optionaly with a style and a label, and with optionnal @caption and @shortcaption. Their list appear after a @listoffloats.

A hash reference is associated with each float, it is available in some formatting functions. The keys are:

caption_texi
shortcaption_texi

A reference on an array containing the caption or shortcaption lines, with texi @-commands.

style_texi

The style with texi @-commands.

style_id

The unique identifier associated with the style.

style

The style formatted.

nr

The number with the same conventions than makeinfo (use the chapter number a dot and then the number of the float of that style in the chapter, or an absolute number if in unnumbered).

chapter_nr

The number of the chapter containing the float.

nr_in_chapter

The number of the float in the chapter.

absolut_nr

The number of the float in the document.

texi

The label with @-commands.

name

The label formatted.

id

The unique identifier associated with the label. Usefull to make an anchor or a reference.

target

The target that can be used to refer to that float.

element

A reference on a structure representing the element the float appear in.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.19.1 Formatting a float

First there is an occasion to construct a texinfo text for the caption, using the caption texinfo lines and the informations in the float structure. The returned lines will be formatted in the main program. A function reference is used here:

Function Reference: (\@caption_lines_returned, \@shortcaption_lines_returned) caption_shortcaption \%float \@caption_lines \@shortcaption_lines

\%float is the structure defined above. \@caption_lines and \@shortcaption_lines are references on arrays containing the texinfo lines for caption and short caption. \@caption_lines_returned and \@shortcaption_lines_returned are references on an array containing the texinfo lines for the caption and shortcaption.

Then the float is formatted with the following function reference:

Function Reference: $text float $float_text \%float $caption_text $shortcaption_text

$float_text is the text appearing within the @float, formatted. \%float is still the structure defined above. $caption_text and $shortcaption_text are the caption and short caption build with the above function and formatted.

It is also possible to do something when a caption or a shortcaption appear with t hefollowing function reference:

Function Reference: $text caption_shortcaption_command $command $formatted_caption \@texi_lines \%float

$command is the @-command, ‘caption’ or ‘shortcaption’. $formatted_caption is the caption text, formatted, while \@texi_lines is a reference on an array containing the caption lines, this time without any formatting. \%float is still the structure defined above.

In the default case this function reference returns an empty string.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.19.2 Formatting lists of floats

A list of floats is introduced by @listoffloats. The argument of @listoffloats is the style. First the style texinfo can be modified with the following function reference:

Function Reference: $style_texi_returned listoffloats_style $style_texi

$style_texi is the @listoffloats argument with texinfo @-commands kept. It is possible to make changes to the $style_texi and return a modified string, still with @-commands. The modified string is formatted in the main program.

After that, for each of the floats with that style, first there is a possibility to modify the float style and the float caption before they are formatted in the main program, with the following function references:

Function Reference: $float_style_texi_returned listoffloats_float_style $style_texi \%float

$style_texi is the style, and \%float is the structure described above. This function reference returns a style to be formatted in the main program.

Function Reference: $caption_texi_returned listoffloats_caption \%float

\%float is the structure described above. This function reference returns a caption to be formatted in the main program.

Each entry is formatted by:

Function Reference: $listoffloats_entry listoffloats_entry $style_texi \%float $float_style $caption $href

$style_texi is the style with @-commands, $float_style is the style returned by the above function and formatted. $caption is the caption returned by the above function formatted. \%float is the structure corresponding with the float, and $href is an href pointing to the float location.

Lastly, the whole @listoffloats is formatted by:

Function Reference: $listoffloats listoffloats $style_texi $style \@listoffloats_entries

$style_texi is the style with @-commands, $style is the style returned by the above function and formatted. The array reference \@listoffloats_entries holds the entries formatted by the above function.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.20 Customizing the footnotes formatting

Each footnote is associated with a footnote entry. Several footnote entries are grouped in a footnote section. When a footnote appears, two things must be formatted: in the main text the place where the footnote appear and the footnote text.

Two functions, with corresponding function references control the formatting of the footnotes:

Function Reference: (\@lines $text_for_document) foot_line_and_ref $number_in_doc $number_in_page $footnote_id $place_id $document_file $footnote_file \@lines \%state

$number_in_doc is the footnote number in the whole document, $number_in_page is the footnote number in the current page. $footnote_id is an identifier for the footnote in the footnote text which should be used to make target for references to that footnote, while $place_id is an identifier for the location of the footnote in the main document. Similarly, $document_file is the file name of the file containing the text where the footnote appears in the main document, while $footnote_file is the file name of the file where the footnote text appears.

\@lines is a reference on an array containing the footnote text lines, allready formatted. And \%state holds informations about the context at the footnote place in the main document. As usual the most usefull entry is preformatted which is true if the footnote appears in a preformatted context.

This function returns a reference on an array, \@lines containing the updated footnote text for the footnote entry, and $text_for_document, the text appearing at the footnote place in the main document, linking to the footnote entry.

The following function is only used when footnotes are at the bottom of a page and the document is split. For customization of the footnotes page in case they are on a separated page or section, Customizing the layout of the special pages. For the determination of the footnote locations, Page layout related command line options.

Function Reference: foot_section \@footnotes_lines

This function formats a group of footnotes. \@footnotes_lines is a reference on an array holding the lines of all the footnote entries formatted as explained above. This function modifies the reference.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.21 Customizing format opening

The following function reference is called when a format is opened. A format is any @-command that ends with a @end except @-commands that only select if the input is processed (like @ignore or @ifhtml) or raw @-commands (like @verbatim and @html).

Function Reference: $line begin_format_texi $command $line \%state

The $command is the format command, the $line is the line following the @-command, \%state is a reference on a hash containing many formatting information. It can modify the line and return something else.

In the default case, it is used to keep track of the multitable nesting. As a consequence, it is linked with the multitable formating. See Multitable formatting.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.22 Bypassing normal formatting

It is possible to bypass completely the normal formatting of @-commands with braces and raw regions (@html, @tex, @xml… regions). In that case the @-commands and the text within are passed to a user defined function early, in a pass when no expansion of output takes place, called the collecting pass. Another user defined function is called during the output expansion phase.

Moreover, arbitrary user defined functions may be called between the different texinfo parsing and outputting passes. This could be used, for example to initialize some things before collecting the @-commands and their text, expanding them between the collecting and expansion phase and doing some cleaning after the expansion pass. These possibilities are used for the interface to LaTeX2HTML (see section Expanding @tex and @math regions using LaTeX2HTML), and the examples are taken from that use.

The @-commands that are keys of the %command_handler hash are collected in the collecting pass and expanded in the expansion pass using user defined functions. The associated value is a reference on a hash used to specify the user defined function references. The key of the hash reference are 'init' for the function reference called during the collecting pass, and 'expand' during the expansion pass. Here is an example for an @-command with braces:

 
$command_handler{'math'} =
     { 'init' => \&Texi2HTML::LaTeX2HTML::to_latex,
       'expand' => \&Texi2HTML::LaTeX2HTML::do_tex
     };

And an example for a raw region @-command:

 
$command_handler{'tex'} =
     { 'init' => \&Texi2HTML::LaTeX2HTML::to_latex,
       'expand' => \&Texi2HTML::LaTeX2HTML::do_tex
     };

The function references are called like:

Function Reference: $status $command_handler{'$command'}->{'init'} $command $text $count

$command is the @-command name, $text is the text appearing within the @-command. $count is a counter counting how many times this @-command appeared. $status is a boolean which should be true if the collecting was succesfull. If false the @-command and the text is discarded.

Function Reference: $result $command_handler{'$command'}->{'expand'} $command $count $state $text

$command is the @-command name, $count is a counter counting how many times this @-command appeared. $state is a reference on a hash containing many informations about the context. $text should be empty. $result is the expanded resulting text.

There are three places for user defined functions, associated with arrays:

@command_handler_init

The function references in that array are called before the collecting pass. At that time the information available is essentially the file names.

@command_handler_process

The function references in that array are called between the collecting pass and the expansion pass. At that time all the special @-commands have been collected as explained above but no output has been produced.

@command_handler_finish

he function references in that array are called after the end of the output generation.

Here is an example of these arrays use:

 
push @command_handler_init, \&Texi2HTML::LaTeX2HTML::init;
push @command_handler_process, \&Texi2HTML::LaTeX2HTML::latex2html;
push @command_handler_finish, \&Texi2HTML::LaTeX2HTML::finish;

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.23 Handling special regions

Special regions @titlepage, @documentdescription and @copying are removed from the document before the last pass in the default case. They can be kept if the value associated with the @-command in the %region_formats_kept hash is true.

The @insertcopying @-command is formatted by

Function Reference: $insertcopying insertcopying $text $comment $simple_text

$text is the text appearing in @copying, formatted. $comment is the text with texi removed, should be very simple text. $simple_text is the text formatted in string context.

The title page handling is described in Formatting of title page.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.24 Customizing other commands, and unknown commands

Many commands without braces are available in texinfo, sometimes with a specific syntax. For example we have @sp, @noindent, @documentlanguage, @oddheading, @headings, @shortcontents, @shorttitlepage or @comment. texi2html interprets some of these commands and some functions or variables are used for their formatting or to access their information. In the default case, however, most of these constructs are ignored.

It is possible to change how the things following these commands on the line are handled, what is considered to be an arg for those commands and it is also possible to keep them instead of discarding them such that it is possible to handle them specially, with the same function than the one used for unknown commands.

Those special commands without braces are the key of a hash: %misc_command. The associated value is a reference on a hash enabling to set the properties of these commands. The keys of this hash reference is the name of a property, the value is the value of the property. For example here we have line for the arg property for the command @-command.

 
$misc_command{'command'} = {'arg' => 'line', 'skip' => 'space'};

The properties and possible values are:

skip

This property enables to set what is skipped after the command arguments. Here are the possible values:

line

The remaining of the line is skipped.

space

Spaces are skipped but not newline.

whitespace

Spaces are skipped

linewhitespace

Spaces are skipped if there are only spaces remaining on the line.

linespace

Spaces are skipped, but not newline if there are only spaces remaining on the line

arg

If the associated value is line the line is considered to be the argument. If it is a number it is the number of args (separated by spaces).

keep

If true the args and the macro are kept, otherwise they are discarded. The defaut is to have keep undef for all the commands. If keep is true for @verbatiminclude the default action for this macro isn’t done.

Commands which don’t appear in the hashes %simple_map, %simple_map_pre, %simple_map_texi and %misc_command, or that appear in %misc_command but with keep true are processed by the following function reference:

Function Reference: ($result_line, $result, $result_text, $message) unknown $command $line $pass

$command is the @-command, $line is the line following the $command. $pass is the pass of texi2html (see section Three passes: macro expansion, document structure and output). $result is a boolean. If it is true then the other return values are taken into account otherwise the default actions are used. In case $result is true, $result_line is the new line to be processed further, $result_text is the resulting formatted text and $message, if defined is a message outputted to the output with line number added by texi2html.

Commands with braces not specified above nor in %style_map, %style_map_pre and %style_map_texi are processed by the following function reference

Function Reference: ($result, $result_text, $message) unknown_style $command $text

$command is the @-command, $text is the text appearing within the braces (allready formatted). $result is a boolean. If it is true then the other return values are taken into account otherwise the default actions are used. In case $result is true, $result_text is the resulting formatted text and $message, if defined is a message outputted to the output with line number added by texi2html.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Derek Price on January 5, 2009 using texi2html 1.82.

Derek Price, CVS developer and technical editor of Essential CVS (Essentials line from O'Reilly Press) , and others offer consulting services and training through Ximbiot.