1 <: # included from keyboard.plp
6 my @incs = glob 'keyboard/altgr/*.eng.inc.pl';
9 title => "altgr keyboard cheat sheets",
12 "Overview of alternate keyboard modes,",
13 "offering extended Unicode characters if a modifier key",
14 "(such as AltGr or option) is pressed.",
17 sheet cheat reference overview keyboard altgr option
19 image => 'data/keyboard/thumb/ibm-m.jpg',
20 stylesheet => [qw( light dark circus mono red )],
21 data => ['keyboard/altgr/index.inc.plp', @incs],
25 display: inline-table; /* centered */
28 border-collapse: separate;
30 border-spacing: .4vw; /* inline td margin equivalent */
35 @media (max-width: 48em) {
39 .keys.big.cmp tbody a {
44 display: table-row-group;
51 position: static; /* under sticky thead */
60 src: url(/osicon.ttf);
77 /* subsequent graphs */
81 display: inline-block;
90 border: 1px solid #000;
91 border-right-width: 0;
94 .graph > :last-of-type {
95 border-right-width: 1px;
98 border-left: 0; /* assume following unext */
104 vertical-align: middle;
111 <h1>Extended keyboards</h1>
113 <p>Overview of available key layouts with AltGr or similar modifier keys.</p>
116 my @sample = split /(?<!\+)/, $get{sample} // 'asSci1!+1';
117 require Shiar_Sheet::Keyboard;
118 use List::Util qw( uniq max );
121 legacy => qq{<span class=icon title="deprecated">\N{TOP HAT}</span>},
122 windows => qq{<span class=icon title="Windows">\x{1FA9F}</span>}, # \N{WINDOW}
123 macos => qq{<span class=icon title="MacOS">\N{RED APPLE}</span>},
124 xorg => qq{<span class=icon title="Xorg">\N{PENGUIN}</span>},
127 printf '<section class="%s">', @sample ? 'section' : 'gallery';
129 print '<table class="big keys cmp">';
130 print '<thead><tr><th colspan=2>';
131 print "<th>$_" for @sample;
134 my %idx = map {s/\Q.inc.pl\E$//; ($_ => eval{ Data($_) })} @incs;
135 my $most = max(map { scalar keys %{$_->{def}{''}} } values %idx);
137 ($idx{$a}{category} // 0) cmp ($idx{$b}{category} // 0)
140 print @sample ? '<tr><th>' : '<figure>';
141 printf '<a href="/%s">', $inc =~ s/\.eng$//r;
142 my $table = $idx{$inc};
143 my $title = $table && $table->{title} || $inc;
146 if ($table and my $img = $table->{image}) {
147 EscapeHTML $name = $table->{imagealt} // $img =~ m{.*/([^/.]*)};
148 print qq{<img src="/$img" alt="$name" />};
150 printf '<figcaption>%s</figcaption>', $title;
155 print '</a>', "\n\t";
156 my $keys = Shiar_Sheet::Keyboard->new($table);
157 for my $mode ($keys->{mode} ? sort keys %{ $keys->{mode} } : '') {
159 $inventory{$_}++ for grep { /^g[2-9]/ } map { s/ (?!ext).*//r }
160 values %{ $keys->{def}{$mode} };
161 print '<span class=graph>';
162 printf '<label>%s</label>', s/\s.*//r for $keys->{key}{$mode} || ();
163 for my $g (sort keys %inventory) {
164 printf '<span class="%s" style="width:%.0f%%" title="%3$d %4$s"> %s</span>',
165 $g, $_/$most*100, $_,
167 $keys->{flag}{$_}[0] || 'extra' # legend label of each class
168 } reverse split / /, $g)
173 print "\t<td class=ni>";
174 print join ' ', map { $caticon{$_} // () } split m{/}, $keys->{category} // '';
176 $keys->print_key('', $_, ($keys->{def}{''}{$_} // 'ni') =~ s/ mode\S*//r)
181 print '</table>' if @sample;