<div>
<:
+use List::Util qw( pairs );
+
my @table = do 'writing-latn.inc.pl';
if ($! or $@) {
- printf "<p class=error>Table data not found: <em>%s</em>.</p>\n", $@ || $!;
+ Alert("Table data not found", $@ || $!);
}
else {
say '<table class="glyphs">';
- print ref $_ ne 'ARRAY' ? "<tr><th>$_\n" : map {/^<td/ ? $_ : "\t<td>$_\n"} @$_
- for @table;
+ for my $row (pairs @table) {
+ my ($title, $cells) = @{$row};
+ say '<tr><th>', $title;
+ print /^<td/ ? $_ : "\t<td>$_\n" for @{$cells};
+ }
say "</table>\n";
}