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 stylesheet => [qw( light dark circus mono red )],
22 data => ["$dirbase/index.inc.plp", "$indexfile.inc.pl"],
26 display: inline-table; /* centered */
29 border-collapse: separate;
31 border-spacing: .4vw; /* inline td margin equivalent */
36 @media (max-width: 48em) {
40 .keys.big.cmp tbody a {
45 display: table-row-group;
52 position: static; /* under sticky thead */
61 src: url(/osicon.ttf);
78 /* subsequent graphs */
82 display: inline-block;
91 border: 1px solid #000;
92 border-right-width: 0;
95 .graph > :last-of-type {
96 border-right-width: 1px;
99 border-left: 0; /* assume following unext */
105 vertical-align: middle;
112 <h1>Extended keyboards</h1>
114 <p>Overview of available key layouts with AltGr or similar modifier keys.
115 Also see <a href="/digraphs">digraphs</a> for compose key combinations.
119 my $idx = Data($indexfile);
121 push @incs, @{ $idx->{$_} } for @{ $idx->{default} };
123 my @sample = split /(?<!\+)/, $get{sample} // 'asSci1!+1';
124 require Shiar_Sheet::Keyboard;
125 Shiar_Sheet::Keyboard->VERSION(3.00);
126 use List::Util qw( uniq max sum );
129 legacy => qq{<span class=icon title="deprecated">\N{TOP HAT}</span>},
130 windows => qq{<span class=icon title="Windows">\x{1FA9F}</span>}, # \N{WINDOW}
131 macos => qq{<span class=icon title="MacOS">\N{RED APPLE}</span>},
132 xorg => qq{<span class=icon title="Xorg">\N{PENGUIN}</span>},
135 printf '<section class="%s">', @sample ? 'section' : 'gallery';
137 print '<table class="big keys cmp">';
138 print '<thead><tr><th colspan=2>';
139 print "<th>$_" for @sample;
142 my $most = max(map { sum values %{ $_->{inventory}{''} } } %{$idx}{@incs});
143 for my $inc (@incs) {
144 my $table = $idx->{$inc};
145 print @sample ? '<tr><th>' : '<figure>';
146 printf '<a href="/%s">', "$dirbase/$inc";
147 my $title = $table->{title} || $inc;
150 if (my $img = $table->{image}) {
151 EscapeHTML $name = $table->{imagealt} // $img =~ m{.*/([^/.]*)};
152 print qq{<img src="/$img" alt="$name" />};
154 printf '<figcaption>%s</figcaption>', $title;
159 print '</a>', "\n\t";
160 for my $mode ($table->{mode} ? sort keys %{ $table->{mode} } : '') {
161 print '<span class=graph>';
162 printf "<label>%s</label>", m/^(\S*)/
163 for $mode && $table->{mode}{$mode} || ();
164 for my $g (sort keys %{ $table->{inventory}{$mode} }) {
165 printf '<span class="%s" style="width:%.0f%%" title="%3$d %4$s"> %s</span>',
166 $g, $_/$most*100, $_,
168 $table->{flag}{$_}[0] || 'extra' # legend label of each class
169 } reverse split / /, $g)
170 for $table->{inventory}{$mode}{$g};
174 print "\t<td class=ni>";
175 print join ' ', map { $caticon{$_} // () }
176 split m{/}, $table->{category} // '';
178 if (my $keys = eval {
179 my $keydata = Data("$dirbase/$inc.eng");
180 Shiar_Sheet::Keyboard->new($keydata)
182 for my $c (@sample) {
183 my $def = $keys->{def}{''}{$c} // [];
185 $def->[0] =~ s/ mode\S*//;
186 $keys->print_key('', $c, $def);
192 print '</table>' if @sample;