HTML::FormatTableRowNroff - Format HTML Table row for nroff


FormatNroff documentation Contained in the FormatNroff distribution.

Index


Code Index:

NAME

Top

HTML::FormatTableRowNroff - Format HTML Table row for nroff

SYNOPSIS

Top

 require HTML::FormatTableRowNroff;
 $row = new HTML::FormatTableRowNroff(%attr);

DESCRIPTION

Top

The HTML::FormatTableRowNroff class is used to store information about a single row of a table. Once information about all the rows of the table has been recorded, an nroff tbl table may be created.

The following attributes are supported: align: 'left','center', or 'right' alignment of table row entries valign: vertical alignment, 'top' or 'middle'

METHODS

Top

$nroff_row->output_format($last_row, $formatter, @widths);

Create a tbl format line for the row. $last_row is true if this is the last row in the table.

$formatter is the formatter being used (e.g. HTML::FormatNroff).

@widths is an array of width information for each cell in the current row, specified in inches.

$nroff_row->add_element(%attr);

Add a new cell to the current row. %attr are the cell attributes, as defined in HTML::FormatTableCellNroff.

$nroff_row->end_element();

Finish the current cell.

SEE ALSO

Top

HTML::FormatTable, HTML::FormatTableNroff HTML::FormatTableRow HTML::FormatTableCell HTML::FormatTableCellNroff

COPYRIGHT

Top

AUTHOR

Top

Frederick Hirsch <f.hirsch@opengroup.org>


FormatNroff documentation Contained in the FormatNroff distribution.
package HTML::FormatTableRowNroff;

require 5.004;

require HTML::FormatTableRow;
@ISA = qw(HTML::FormatTableRow);

require HTML::FormatTableCellNroff;

use strict;
use Carp;

sub output_format {
    my($self, $final, $formatter, @widths) = @_;

    my $cell;
    my $index = 0;
    foreach $cell ( @ { $self->{'cells'} }) {
	my $str = $cell->format_str($widths[$index]);
	$formatter->out("$str ");
	$index++;
    }
    $cell = $self->{'current_cell'};
    if(defined $cell && $cell ne "") {
	my $str = $cell->format_str($widths[$index]);
	$formatter->out("$str");
    }
    if($final) {
	$formatter->out(".\n");
    } else {
	$formatter->out("\n");
    }
}

sub add_element {
    my($self, %attr) = @_;

    if(defined($self->{'current_cell'})) {
	push(@ {$self->{'cells'}},  $self->{'current_cell'});
    }

    $self->{'ended'} = 0;
    $self->{'current_cell'} = new HTML::FormatTableCellNroff(%attr);
}

sub end_element {
    my($self) = @_;

    $self->{'ended'} = 1;
}

1;