From 02e6a32fd44d994d88f8bcb79d47e217455c580d Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 3 Apr 2012 00:52:34 +0200 Subject: [PATCH] font: describe search query --- font.plp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/font.plp b/font.plp index ddc35b4..4cc99c9 100644 --- a/font.plp +++ b/font.plp @@ -52,12 +52,14 @@ for my $os (@ossel) { # 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} }; @@ -73,12 +75,14 @@ for ($query) { } } 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 $_ } @@ -90,12 +94,15 @@ for ($query) { } } -@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 ''; +say ''; print '' x 3; print "" for 2, map { scalar @{$oslist{$_}} } @ossel; -- 2.30.0
'.EscapeHTML(join ', ', @querydesc).'