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.</p>
117 my $idx = Data($indexfile);
119 push @incs, @{ $idx->{$_} } for @{ $idx->{default} };
121 my @sample = split /(?<!\+)/, $get{sample} // 'asSci1!+1';
122 require Shiar_Sheet::Keyboard;
123 Shiar_Sheet::Keyboard->VERSION(3.00);
124 use List::Util qw( uniq max sum );
127 legacy => qq{<span class=icon title="deprecated">\N{TOP HAT}</span>},
128 windows => qq{<span class=icon title="Windows">\x{1FA9F}</span>}, # \N{WINDOW}
129 macos => qq{<span class=icon title="MacOS">\N{RED APPLE}</span>},
130 xorg => qq{<span class=icon title="Xorg">\N{PENGUIN}</span>},
133 printf '<section class="%s">', @sample ? 'section' : 'gallery';
135 print '<table class="big keys cmp">';
136 print '<thead><tr><th colspan=2>';
137 print "<th>$_" for @sample;
140 my $most = max(map { sum values %{ $_->{inventory}{''} } } %{$idx}{@incs});
141 for my $inc (@incs) {
142 my $table = $idx->{$inc};
143 print @sample ? '<tr><th>' : '<figure>';
144 printf '<a href="/%s">', "$dirbase/$inc";
145 my $title = $table->{title} || $inc;
148 if (my $img = $table->{image}) {
149 EscapeHTML $name = $table->{imagealt} // $img =~ m{.*/([^/.]*)};
150 print qq{<img src="/$img" alt="$name" />};
152 printf '<figcaption>%s</figcaption>', $title;
157 print '</a>', "\n\t";
158 for my $mode ($table->{mode} ? sort keys %{ $table->{mode} } : '') {
159 print '<span class=graph>';
160 printf '<label>%s</label>', s/\s.*//r for $table->{def}{''}{$mode}[1] || ();
161 for my $g (sort keys %{ $table->{inventory}{$mode} }) {
162 printf '<span class="%s" style="width:%.0f%%" title="%3$d %4$s"> %s</span>',
163 $g, $_/$most*100, $_,
165 $table->{flag}{$_}[0] || 'extra' # legend label of each class
166 } reverse split / /, $g)
167 for $table->{inventory}{$mode}{$g};
171 print "\t<td class=ni>";
172 print join ' ', map { $caticon{$_} // () } split m{/}, $table->{category} // '';
174 if (my $keys = eval {
175 my $keydata = Data("$dirbase/$inc.eng");
176 Shiar_Sheet::Keyboard->new($keydata)
178 $keys->print_key('', $_, ($keys->{def}{''}{$_} // ['ni']) =~ s/ mode\S*//r)
184 print '</table>' if @sample;