1 <: # included from keyboard.plp
6 my $dirbase = 'keyboard/altgr';
7 my $indexfile = "$dirbase/index";
10 title => "altgr keyboard cheat sheets",
13 "Overview of alternate keyboard modes,",
14 "offering extended Unicode characters if a modifier key",
15 "(such as AltGr or option) is pressed.",
18 sheet cheat reference overview keyboard altgr option
20 image => "$dirbase/thumb/ibm-m.jpg",
21 data => ["$dirbase/index.inc.plp", "$indexfile.inc.pl"],
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.
114 Also see <a href="/digraphs">digraphs</a> for compose key combinations.
118 my $idx = Data($indexfile);
120 push @incs, @{ $idx->{$_} } for @{ $idx->{default} };
122 my @sample = split /(?<!\+)/, $get{sample} // 'asSci1!+1';
123 require Shiar_Sheet::Keyboard;
124 Shiar_Sheet::Keyboard->VERSION(3.00);
125 use List::Util qw( uniq max sum );
128 legacy => qq{<span class=icon title="deprecated">\N{TOP HAT}</span>},
129 windows => qq{<span class=icon title="Windows">\x{1FA9F}</span>}, # \N{WINDOW}
130 macos => qq{<span class=icon title="MacOS">\N{RED APPLE}</span>},
131 xorg => qq{<span class=icon title="Xorg">\N{PENGUIN}</span>},
134 printf '<section class="%s">', @sample ? 'section' : 'gallery';
136 print '<table class="big keys cmp">';
137 print '<thead><tr><th colspan=2>';
138 print "<th>$_" for @sample;
142 map { sum values %{$_} } map { $_->{inventory}{''} } @{$idx}{@incs}
144 for my $inc (@incs) {
145 my $table = $idx->{$inc};
146 print @sample ? '<tr><th>' : '<figure>';
147 printf '<a href="/%s">', "$dirbase/$inc";
148 my $title = $table->{title} || $inc;
151 if (my $img = $table->{image}) {
152 EscapeHTML $name = $table->{imagealt} // $img =~ m{.*/([^/.]*)};
153 print qq{<img src="/$img" alt="$name" />};
155 printf '<figcaption>%s</figcaption>', $title;
160 print '</a>', "\n\t";
161 for my $mode ($table->{mode} ? sort keys %{ $table->{mode} } : '') {
162 print '<span class=graph>';
163 printf "<label>%s</label>", m/^(\S*)/
164 for $mode && $table->{mode}{$mode} || ();
165 for my $g (sort keys %{ $table->{inventory}{$mode} }) {
166 printf '<span class="%s" style="width:%.0f%%" title="%3$d %4$s"> %s</span>',
167 $g, $_/$most*100, $_,
169 $table->{flag}{$_}[0] || 'extra' # legend label of each class
170 } reverse split / /, $g)
171 for $table->{inventory}{$mode}{$g};
175 print "\t<td class=ni>";
176 print join ' ', map { $caticon{$_} // () }
177 split m{/}, $table->{category} // '';
179 if (my $keys = eval {
180 my $keydata = Data("$dirbase/$inc.eng");
181 Shiar_Sheet::Keyboard->new($keydata)
183 for my $c (@sample) {
184 my $def = $keys->{def}{''}{$c} // [];
186 $def->[0] =~ s/ mode\S*//;
187 $keys->print_key('', $c, $def);
193 print '</table>' if @sample;