NAME

HTML::FormatTableNroff - Format HTML Table as nroff

SYNOPSIS

require HTML::FormatTableNroff;
$table =  new HTML::FormatTableNroff($self, %attr);

DESCRIPTION

The HTML::FormatTableNroff is a formatter that outputs tbl, nroff and man macro source for HTML tables. It is called by the HTML::FormatNroff formatter to process HTML tables.

METHODS

$width = $nroff_table->calculate_width($total, $num);

Calculate the width to use for the cell, using the following data:

$nroff_table->{'page_width'} is the number of inches available
   on the page (6 if not set)

$nroff_table->{'width'} specifies the percent of this available to 
   the table (e.g. "75%") 

$total is calculated by determining the maximum width cell for each 
column and then adding these maximums for each column.

$num is the maximum width cell for this column.

The algorithm attempts to allocate the available table width (the percentage of the page width) to the rows as the percentage the max width of the column has with respect to the total.

In order to make a small width column avoid unnecessary wrapping, if the result width is less than an inch, a width corresponding to the max number of characters is used ( aproximately the number/12 since 1em is about 12 points) (See "A TROFF tutorial", by Kernighan)

The global HTML::FormatTableNroff::$_width_used is use to track the amount of page width used by previous columns.

$nroff_table->attributes();

Return tbl attributes associated with table itself as a string. expand will be specified if the table width is not explicitly specified or is not 100%. If centering is specified for the document region containing the table, then the table will have the center attribute.

$nroff_table->output();

Output the entire table, using the formatter associated with the table, unless there is no table content - just put out a .sp in this case.

A table is output as follows:

.sp
.TS
table attributes;
row specification
row specification.
row
row
.TE

$nroff_table->add_row(%attr);

Add a row to the table, with row attributes specified in %attr.

$nroff_table->row_iterator($method, @args);

Apply $method to each row of the table, passing @args, as follows: $row->$method($last_row, @args);

$last_row is set appropriately and used to signal to method whether this is the last row in the table.

SEE ALSO

HTML::FormatNroff HTML::FormatTable HTML::FormatTableRow HTML::FormatTableRowNroff

COPYRIGHT

Copyright (c) 1997 Frederick Hirsch. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Frederick Hirsch <f.hirsch@opengroup.org>