- print '<table class="glyphs">';
- print ref $_ ne 'ARRAY' ? "<tr><th>$_" : map {"<td>$_"} @$_ for @table;
- print "</table>\n\n";
+ say '<table class="glyphs">';
+ for my $row (pairs @table) {
+ my ($title, $cells) = @{$row};
+ printf '<tr id="%s">', (lc $title) =~ s/<[^>]+>//gr =~ s/\s+/-/gr;
+ say '<th>', $title;
+ say "\t", '<td>' x !/^<td/, $_ for @{$cells};
+ }
+ say "</table>\n";