Frederick Hirsch


HTML::FormatTableNroff - Format HTML Table as nroff


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


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.


$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.


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.


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:

 table attributes;
 row specification
 row specification.


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.


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


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.


Frederick Hirsch <>