sub table {
my ($tab,$opt) = @_;
my $attributes = get_attributes($opt,['id','class','style']);
my $open = 'table'.$attributes;
line($tab,qq(<$open>));
line($tab + 1,qq(
$opt->{caption})) if $opt->{caption};
cols($tab + 1, $_) if $opt->{cols};
for my $rowgroup (@{$opt->{rows}) {
my $type = $rowgroup->[0];
my @rows = @{$rowgroup->[1];
my $attributes = $rowgroup->[2];
for my $row (@rows) {
if ($type eq 'header') {
row($tab + 1, $type , $row);
}
else {
row($tab + 1, $type , $_) for @$row;
}
}
}
line($tab,q());
}