- return sprintf qq{<table class="glyphs%s">\n%s</table>\n},
- @{ $self->{anno} } ? ' dilabel' : '',
- join '', map {"$_\n"} @rows;
+ return @html;
+}
+
+sub tabletag {
+ my ($self) = @_;
+ my $class = 'glyphs';
+ $class .= ' dilabel' if @{ $self->{anno} };
+ return sprintf '<table class="%s">', $class;
+}
+
+sub table {
+ my ($self, $digraphs) = @_;
+
+ my @rows;
+
+ my @colheads;
+ while ($digraphs->[0] !~ /^\./) {
+ my $cell = shift @$digraphs or last;
+ if ($cell eq '>') {
+ push @colheads, '<tr>';
+ next;
+ }
+ push @colheads, join('',
+ '<',
+ $cell =~ s/^-// ? 'td' : 'th',
+ $cell =~ s/:(.*)// && qq{ title="$1"},
+ $cell =~ s/^(>+)// && ' colspan='.(length($1) + 1),
+ '>',
+ $cell eq '_' ? ' ' : $cell
+ );
+ }
+ push @rows, sprintf '<thead><tr>%s<tbody>', join '', @colheads if @colheads;
+ push @rows, $self->row($digraphs);
+
+ return join '', map {"$_\n"} $self->tabletag, @rows, '</table>';