1 <: # included from keyboard.plp
6 my @incs = glob 'keyboard/altgr/*.eng.inc.pl';
9 title => "altgr keyboard cheat sheets",
12 "Overview of alternate keyboard modes,",
13 "offering extended Unicode characters if a modifier key",
14 "(such as AltGr or option) is pressed.",
17 sheet cheat reference overview keyboard altgr option
19 image => 'data/keyboard/thumb/ibm-m.jpg',
20 stylesheet => [qw( light dark circus mono red )],
21 data => ['keyboard/altgr/index.inc.plp', @incs],
25 display: inline-table; /* centered */
28 border-collapse: separate;
30 border-spacing: .4vw; /* inline td margin equivalent */
36 display: table-row-group;
43 position: static; /* under sticky thead */
52 src: url(/osicon.ttf);
69 /* subsequent graphs */
73 display: inline-block;
82 border: 1px solid #000;
83 border-right-width: 0;
86 .graph > :last-of-type {
87 border-right-width: 1px;
90 border-left: 0; /* assume following unext */
96 vertical-align: middle;
103 <h1>Extended keyboards</h1>
105 <p>Overview of available key layouts with AltGr or similar modifier keys.</p>
108 my @sample = split /(?<!\+)/, $get{sample} // 'asSci1!+1';
109 require Shiar_Sheet::Keyboard;
110 use List::Util qw( uniq max );
113 legacy => qq{<span class=icon title="deprecated">\N{TOP HAT}</span>},
114 windows => qq{<span class=icon title="Windows">\x{1FA9F}</span>}, # \N{WINDOW}
115 macos => qq{<span class=icon title="MacOS">\N{RED APPLE}</span>},
116 xorg => qq{<span class=icon title="Xorg">\N{PENGUIN}</span>},
119 printf '<section class="%s">', @sample ? 'section' : 'gallery';
121 print '<table class="big keys cmp">';
122 print '<thead><tr><th colspan=2>';
123 print "<th>$_" for @sample;
126 my %idx = map {s/\Q.inc.pl\E$//; ($_ => eval{ Data($_) })} @incs;
127 my $most = max(map { scalar keys %{$_->{def}{''}} } values %idx);
129 $idx{$a}{category} cmp $idx{$b}{category} || $a cmp $b
131 print @sample ? '<tr><th>' : '<figure>';
132 printf '<a href="/%s">', $inc =~ s/\.eng$//r;
133 my $table = $idx{$inc};
134 my $title = $table && $table->{title} || $inc;
137 if ($table and my $img = $table->{image}) {
138 EscapeHTML $name = $table->{imagealt} // $img =~ m{.*/([^/.]*)};
139 print qq{<img src="/$img" alt="$name" />};
141 printf '<figcaption>%s</figcaption>', $title;
146 print '</a>', "\n\t";
147 my $keys = Shiar_Sheet::Keyboard->new($table);
148 for my $mode ($keys->{mode} ? sort keys %{ $keys->{mode} } : '') {
150 $inventory{$_}++ for grep { /^g[2-9]/ } map { s/ (?!ext).*//r }
151 values %{ $keys->{def}{$mode} };
152 print '<span class=graph>';
153 print "<label>$_</label>" for $keys->{key}{$mode} =~ s/\s.*//r || ();
154 for my $g (sort keys %inventory) {
155 printf '<span class="%s" style="width:%.0f%%" title="%3$d %4$s"> %s</span>',
156 $g, $_/$most*100, $_,
158 $keys->{flag}{$_}[0] || 'extra' # legend label of each class
159 } reverse split / /, $g)
164 print "\t<td class=ni>";
165 print join ' ', map { $caticon{$_} // () } split m{/}, $keys->{category};
167 $keys->print_key('', $_, ($keys->{def}{''}{$_} // 'ni') =~ s/ mode\S*//r)
172 print '</table>' if @sample;