keyboard/altgr: order index by subpage categories
[sheet.git] / keyboard / altgr / index.inc.plp
index 75c2cc382bced54cd0f6ea4061863ae65673099e..e4ed3d87324f55ad25f061033ae6a1902737eab1 100644 (file)
@@ -34,11 +34,13 @@ img {
 with AltGr or similar modifier keys.</p>
 
 <section class="gallery"><:
-for my $inc (@incs) {
-       $inc =~ s/\Q.inc.pl\E$//;
+my %idx = map {s/\Q.inc.pl\E$//; ($_ => eval{ Data($_) })} @incs;
+for my $inc (sort {
+       $idx{$a}{category} cmp $idx{$b}{category} || $a cmp $b
+} keys %idx) {
        print '<figure>';
        printf '<a href="/%s">', $inc =~ s/\.eng$//r;
-       if (my $table = eval { Data($inc) }) {
+       if ($table = $idx{$inc}) {
                if (my $img = $table->{image}) {
                        EscapeHTML $name = $table->{imagealt} // $img =~ m{.*/([^/.]*)};
                        print qq{<img src="/$img" alt="$name" />};