- say '<tr><th>', $title;
- print /^<td/ ? $_ : "\t<td>$_\n" for @{$cells};
+ 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' if s/^-//;
+ print '>';
+ say;
+ }