# parse input
my @chars;
+my @querydesc;
my $query = $ENV{PATH_INFO} || $get{q} || 'ipa';
for ($query) {
s{^/}{};
when (qr{^[a-z]+(?:/|\z)}) {
for (split / /) {
+ push @querydesc, "preset group $_";
my ($tablegroup, $tablename) = split m{/}, $_, 2;
my @tables = $tablename ? $tables->{$tablegroup}->{$tablename}
: sort values %{ $tables->{$tablegroup} };
}
}
when (qr{[\d,;\s+-]+}) {
+ push @querydesc, "character codepoints $_";
for (map { split /[^\d-]/ } $_) {
my ($charnum, $range) = split /-/, $_;
push @chars, chr $_ for $charnum .. ($range // $charnum);
}
}
when (qr{[A-Z]}) {
+ push @querydesc, "unicode match $_";
eval {
my $match = qr/\A\p{$_}\z/;
push @chars, grep { m/$match/ } map { chr $_ }
}
}
-@chars <= 1500
- or die sprintf 'too many matches (%d)'."\n", scalar @chars;
+@chars <= 1500 or die sprintf(
+ 'too many matches (%d) for %s'."\n",
+ scalar @chars, join(', ', @querydesc),
+);
# output character list
print '<table class=mapped>';
+say '<caption>'.EscapeHTML(join ', ', @querydesc).'</caption>';
print '<col>' x 3;
print "<colgroup span=$_>" for 2, map { scalar @{$oslist{$_}} } @ossel;
print '<tr>';
print '<td colspan=2>unicode';
print '<td>name';
-print '<td>di<td>html';
+print '<td><a href="/digraphs" title="digraph">di</a><td>html';
printf '<td title="%s">%s', $font{$_}->{-name}, $font{$_}->{-id} // $_
for @fontlist;
say '</thead>';