line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormatTableRowNroff; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
HTML::FormatTableRowNroff - Format HTML Table row for nroff |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require HTML::FormatTableRowNroff; |
10
|
|
|
|
|
|
|
$row = new HTML::FormatTableRowNroff(%attr); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
The HTML::FormatTableRowNroff class is used to store information |
15
|
|
|
|
|
|
|
about a single row of a table. Once information about all the rows of |
16
|
|
|
|
|
|
|
the table has been recorded, an nroff tbl table may be created. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
The following attributes are supported: |
19
|
|
|
|
|
|
|
align: 'left','center', or 'right' alignment of table row entries |
20
|
|
|
|
|
|
|
valign: vertical alignment, 'top' or 'middle' |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHODS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
require 5.004; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
require HTML::FormatTableRow; |
29
|
|
|
|
|
|
|
@ISA = qw(HTML::FormatTableRow); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
require HTML::FormatTableCellNroff; |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
|
610
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
45
|
|
34
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
501
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 $nroff_row->output_format($last_row, $formatter, @widths); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Create a tbl format line for the row. $last_row is true if this is the last row in the table. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$formatter is the formatter being used (e.g. |
41
|
|
|
|
|
|
|
C). |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
@widths is an array of width information for each cell in the current row, |
44
|
|
|
|
|
|
|
specified in inches. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub output_format { |
49
|
0
|
|
|
0
|
1
|
0
|
my($self, $final, $formatter, @widths) = @_; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
0
|
my $cell; |
52
|
0
|
|
|
|
|
0
|
my $index = 0; |
53
|
0
|
|
|
|
|
0
|
foreach $cell ( @ { $self->{'cells'} }) { |
|
0
|
|
|
|
|
0
|
|
54
|
0
|
|
|
|
|
0
|
my $str = $cell->format_str($widths[$index]); |
55
|
0
|
|
|
|
|
0
|
$formatter->out("$str "); |
56
|
0
|
|
|
|
|
0
|
$index++; |
57
|
|
|
|
|
|
|
} |
58
|
0
|
|
|
|
|
0
|
$cell = $self->{'current_cell'}; |
59
|
0
|
0
|
0
|
|
|
0
|
if(defined $cell && $cell ne "") { |
60
|
0
|
|
|
|
|
0
|
my $str = $cell->format_str($widths[$index]); |
61
|
0
|
|
|
|
|
0
|
$formatter->out("$str"); |
62
|
|
|
|
|
|
|
} |
63
|
0
|
0
|
|
|
|
0
|
if($final) { |
64
|
0
|
|
|
|
|
0
|
$formatter->out(".\n"); |
65
|
|
|
|
|
|
|
} else { |
66
|
0
|
|
|
|
|
0
|
$formatter->out("\n"); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 $nroff_row->add_element(%attr); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Add a new cell to the current row. %attr are the cell attributes, |
73
|
|
|
|
|
|
|
as defined in C. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub add_element { |
78
|
1
|
|
|
1
|
1
|
6
|
my($self, %attr) = @_; |
79
|
|
|
|
|
|
|
|
80
|
1
|
50
|
|
|
|
10
|
if(defined($self->{'current_cell'})) { |
81
|
0
|
|
|
|
|
0
|
push(@ {$self->{'cells'}}, $self->{'current_cell'}); |
|
0
|
|
|
|
|
0
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
1
|
|
|
|
|
2
|
$self->{'ended'} = 0; |
85
|
1
|
|
|
|
|
7
|
$self->{'current_cell'} = new HTML::FormatTableCellNroff(%attr); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 $nroff_row->end_element(); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Finish the current cell. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub end_element { |
95
|
1
|
|
|
1
|
1
|
4
|
my($self) = @_; |
96
|
|
|
|
|
|
|
|
97
|
1
|
|
|
|
|
4
|
$self->{'ended'} = 1; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 SEE ALSO |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
L, L |
103
|
|
|
|
|
|
|
L |
104
|
|
|
|
|
|
|
L |
105
|
|
|
|
|
|
|
L |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 COPYRIGHT |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Copyright (c) 1997 Frederick Hirsch. All rights reserved. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or |
112
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 AUTHOR |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Frederick Hirsch |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |