|
7.11 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.
7.11.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:
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.
- 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
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.
- 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
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.
- 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
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.
- Function Reference: $multitable_row row $text $item_command
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 is the command used to introduce
the row, such that it is possible to distinguish between @item and
@headitem.
7.11.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 $command $text
$command is the Texinfo command name, $text is the formatted
items.
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.
Doku-Base
This document was created by Netzdino using texi2html.
|