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 use List::Util qw( uniq max );
126 legacy => qq{<span class=icon title="deprecated">\N{TOP HAT}</span>},
127 windows => qq{<span class=icon title="Windows">\x{1FA9F}</span>}, # \N{WINDOW}
128 macos => qq{<span class=icon title="MacOS">\N{RED APPLE}</span>},
129 xorg => qq{<span class=icon title="Xorg">\N{PENGUIN}</span>},
132 printf '<section class="%s">', @sample ? 'section' : 'gallery';
134 print '<table class="big keys cmp">';
135 print '<thead><tr><th colspan=2>';
136 print "<th>$_" for @sample;
139 my %idx = map {($_ => scalar eval{ Data("$dirbase/$_.eng") })} @incs;
140 my $most = max(map { scalar keys %{$_->{def}{''}} } values %idx);
141 for my $inc (@incs) {
142 print @sample ? '<tr><th>' : '<figure>';
143 printf '<a href="/%s">', "$dirbase/$inc";
144 my $table = $idx{$inc};
145 my $title = $table && $table->{title} || $inc;
148 if ($table and 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 my $keys = Shiar_Sheet::Keyboard->new($table);
159 for my $mode ($keys->{mode} ? sort keys %{ $keys->{mode} } : '') {
161 $inventory{$_}++ for grep { /^g[2-9]/ } map { s/ (?!ext).*//r }
162 values %{ $keys->{def}{$mode} };
163 print '<span class=graph>';
164 printf '<label>%s</label>', s/\s.*//r for $keys->{key}{$mode} || ();
165 for my $g (sort keys %inventory) {
166 printf '<span class="%s" style="width:%.0f%%" title="%3$d %4$s"> %s</span>',
167 $g, $_/$most*100, $_,
169 $keys->{flag}{$_}[0] || 'extra' # legend label of each class
170 } reverse split / /, $g)
175 print "\t<td class=ni>";
176 print join ' ', map { $caticon{$_} // () } split m{/}, $keys->{category} // '';
178 $keys->print_key('', $_, ($keys->{def}{''}{$_} // 'ni') =~ s/ mode\S*//r)
183 print '</table>' if @sample;