keyboard/altgr: order index by subpage categories
[sheet.git] / keyboard / altgr / index.inc.plp
1 <: # included from keyboard.plp
2 use 5.014;
3 use warnings;
4
5 my @incs = glob 'keyboard/altgr/*.eng.inc.pl';
6
7 Html({
8         title => "altgr keyboard cheat sheets",
9         version => '1.0',
10         description => [
11                 "Overview of alternate keyboard modes,",
12                 "offering extended Unicode characters if a modifier key",
13                 "(such as AltGr or option) is pressed.",
14         ],
15         keywords => [qw'
16                 sheet cheat reference overview keyboard altgr option
17         '],
18         stylesheet => [qw( light dark circus mono red )],
19         data => ['keyboard/altgr/index.inc.plp', @incs],
20         raw => <<'.',
21 <style>
22 img {
23         object-fit: cover;
24         height: 100%;
25 }
26 </style>
27 .
28 });
29
30 :>
31 <h1>Extended keyboards</h1>
32
33 <p>Representative images of available layouts
34 with AltGr or similar modifier keys.</p>
35
36 <section class="gallery"><:
37 my %idx = map {s/\Q.inc.pl\E$//; ($_ => eval{ Data($_) })} @incs;
38 for my $inc (sort {
39         $idx{$a}{category} cmp $idx{$b}{category} || $a cmp $b
40 } keys %idx) {
41         print '<figure>';
42         printf '<a href="/%s">', $inc =~ s/\.eng$//r;
43         if ($table = $idx{$inc}) {
44                 if (my $img = $table->{image}) {
45                         EscapeHTML $name = $table->{imagealt} // $img =~ m{.*/([^/.]*)};
46                         print qq{<img src="/$img" alt="$name" />};
47                 }
48                 $inc = $table->{title};
49         }
50         printf '<figcaption>%s</figcaption>', $inc;
51         say '</a></figure>';
52 }
53 :></section>
54