keyboard/altgr/index: silence uninitializedness warnings
[sheet.git] / keyboard / altgr / index.inc.plp
index 7966426ed2ee2ec0c9b5f15dee1b3a7d4f1a65bb..9e4d6b53dc88bf3e2b99995d45a9a61a4bfd6708 100644 (file)
@@ -32,6 +32,14 @@ Html({
 .keys.big.cmp tbody {
        font-size: 150%;
 }
+@media (max-width: 48em) {
+       .keys.big.cmp tbody {
+               font-size: 100%;
+       }
+       .keys.big.cmp tbody a {
+               white-space: normal;
+       }
+}
 .keys.cmp tbody {
        display: table-row-group;
 }
@@ -47,6 +55,18 @@ Html({
        text-align: right;
 }
 
+@font-face {
+       font-family: osicons;
+       src: url(/osicon.ttf);
+}
+.icon {
+       font-family: osicons;
+}
+.keys.cmp tbody .ni {
+       font-size: 80%;
+       padding: 0 .2em;
+}
+
 .graph {
        display: block;
        line-height: 1ex;
@@ -98,10 +118,10 @@ require Shiar_Sheet::Keyboard;
 use List::Util qw( uniq max );
 
 my %caticon = (
-       legacy  => "\N{TOP HAT}",
-       windows => "\x{1FA9F}", # \N{WINDOW}
-       macos   => "\N{RED APPLE}",
-       xorg    => "\N{PENGUIN}",
+       legacy  => qq{<span class=icon title="deprecated">\N{TOP HAT}</span>},
+       windows => qq{<span class=icon title="Windows">\x{1FA9F}</span>}, # \N{WINDOW}
+       macos   => qq{<span class=icon title="MacOS">\N{RED APPLE}</span>},
+       xorg    => qq{<span class=icon title="Xorg">\N{PENGUIN}</span>},
 );
 
 printf '<section class="%s">', @sample ? 'section' : 'gallery';
@@ -114,7 +134,8 @@ if (@sample) {
 my %idx = map {s/\Q.inc.pl\E$//; ($_ => eval{ Data($_) })} @incs;
 my $most = max(map { scalar keys %{$_->{def}{''}} } values %idx);
 for my $inc (sort {
-       $idx{$a}{category} cmp $idx{$b}{category} || $a cmp $b
+       ($idx{$a}{category} // 0) cmp ($idx{$b}{category} // 0)
+       || $a cmp $b
 } keys %idx) {
        print @sample ? '<tr><th>' : '<figure>';
        printf '<a href="/%s">', $inc =~ s/\.eng$//r;
@@ -135,9 +156,10 @@ for my $inc (sort {
                my $keys = Shiar_Sheet::Keyboard->new($table);
                for my $mode ($keys->{mode} ? sort keys %{ $keys->{mode} } : '') {
                        my %inventory;
-                       $inventory{ s/ (?!ext).*//r }++ for values %{ $keys->{def}{$mode} };
+                       $inventory{$_}++ for grep { /^g[2-9]/ } map { s/ (?!ext).*//r }
+                               values %{ $keys->{def}{$mode} };
                        print '<span class=graph>';
-                       print "<label>$_</label>" for $keys->{key}{$mode} =~ s/\s.*//r || ();
+                       printf '<label>%s</label>', s/\s.*//r for $keys->{key}{$mode} || ();
                        for my $g (sort keys %inventory) {
                                printf '<span class="%s" style="width:%.0f%%" title="%3$d %4$s"> %s</span>',
                                        $g, $_/$most*100, $_,
@@ -148,10 +170,11 @@ for my $inc (sort {
                        }
                        say '</span>';
                }
-               print "\t<th>";
-               print join '<br>', map { $caticon{$_} // () } split m{/}, $keys->{category};
+               print "\t<td class=ni>";
+               print join ' ', map { $caticon{$_} // () } split m{/}, $keys->{category} // '';
                say '';
-               $keys->print_key('', $_, $keys->{def}{''}{$_} // 'ni') for @sample;
+               $keys->print_key('', $_, ($keys->{def}{''}{$_} // 'ni') =~ s/ mode\S*//r)
+                       for @sample;
                say '</tr>';
        }
 }