X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/0f3a55ca3cfa02e2446a20dc050d04490b23bb8d..f88a74c510e90c9c864d37bfaaf23fefa1a0fbdc:/word.plp
diff --git a/word.plp b/word.plp
index 41d2bd3..f47c4f4 100644
--- a/word.plp
+++ b/word.plp
@@ -1,12 +1,13 @@
<(common.inc.plp)><:
our $lang = $get{lang} || 'en';
-our $wordlistbase = "data/wordlist.$lang";
+our $wordlistbase = "data/wordlist";
if ($Request and $Request =~ m{\A([^/]+)}) {
my $page = "word/$1.plp";
utf8::downgrade($page); # unicode filename breaks contents encoding
if (-e $page) {
+ $wordlistbase .= ".$lang";
Include $page;
exit;
}
@@ -90,7 +91,7 @@ sub showimg {
sub printimgs {
say '
';
for my $row (@_) {
- my ($id, $level, $title) = split /:/, $row, 3;
+ my ($id, $level, $title) = @{$row};
$id or die "empty reference"; # assertion to prevent loops
my @type;
push @type, 'parent' if defined $table->{$id};
@@ -110,8 +111,8 @@ if (exists $get{q}) {
if ($Request) {
my @query = $Request;
while (@query) {
- push @rows, grep { (split /:/)[1] <= $limit } @query;
- s/:.*// for @query;
+ push @rows, grep { $_->[1] <= $limit } @query;
+ $_ = $_->[0] for @query;
@query = map {$_ ? @{$_} : ()} @{$table}{@query};
}
}
@@ -122,7 +123,10 @@ if (exists $get{q}) {
$table = {};
printimgs(@rows);
}
+elsif ($Request and $Request =~ /^\d+$/) {
+ printimgs([$Request]);
+}
else {
- printimgs($Request || $table->{''}->[0]);
+ printimgs($table->{''}->[0]);
}
say '';