- print '<table class="glyphs">';
- print ref $_ ne 'ARRAY' ? "<tr><th>$_" : map {/^<td/ ? $_ : "<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;
+ my $colspan = 1;
+ for (@{$cells}) {
+ if ($_ eq '>') {
+ $colspan++;
+ next;
+ }
+ print "\t<td";
+ if ($colspan > 1) {
+ print " colspan=$colspan";
+ $colspan = 1;
+ }
+ print ' class=', $_ ? 'ex' : 'u-invalid' if s/^-//;
+ print '>';
+ say;
+ }
+ }
+ say "</table>\n";