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;
143 map { sum values %{$_} } map { $_->{inventory}{''} } @{$idx}{@incs}
145 for my $inc (@incs) {
146 my $table = $idx->{$inc};
147 print @sample ? '<tr><th>' : '<figure>';
148 printf '<a href="/%s">', "$dirbase/$inc";
149 my $title = $table->{title} || $inc;
152 if (my $img = $table->{image}) {
153 EscapeHTML $name = $table->{imagealt} // $img =~ m{.*/([^/.]*)};
154 print qq{<img src="/$img" alt="$name" />};
156 printf '<figcaption>%s</figcaption>', $title;
161 print '</a>', "\n\t";
162 for my $mode ($table->{mode} ? sort keys %{ $table->{mode} } : '') {
163 print '<span class=graph>';
164 printf "<label>%s</label>", m/^(\S*)/
165 for $mode && $table->{mode}{$mode} || ();
166 for my $g (sort keys %{ $table->{inventory}{$mode} }) {
167 printf '<span class="%s" style="width:%.0f%%" title="%3$d %4$s"> %s</span>',
168 $g, $_/$most*100, $_,
170 $table->{flag}{$_}[0] || 'extra' # legend label of each class
171 } reverse split / /, $g)
172 for $table->{inventory}{$mode}{$g};
176 print "\t<td class=ni>";
177 print join ' ', map { $caticon{$_} // () }
178 split m{/}, $table->{category} // '';
180 if (my $keys = eval {
181 my $keydata = Data("$dirbase/$inc.eng");
182 Shiar_Sheet::Keyboard->new($keydata)
184 for my $c (@sample) {
185 my $def = $keys->{def}{''}{$c} // [];
187 $def->[0] =~ s/ mode\S*//;
188 $keys->print_key('', $c, $def);
194 print '</table>' if @sample;