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 */
57 /* subsequent graphs */
61 display: inline-block;
70 border: 1px solid #000;
71 border-right-width: 0;
74 .graph > :last-of-type {
75 border-right-width: 1px;
78 border-left: 0; /* assume following unext */
84 vertical-align: middle;
91 <h1>Extended keyboards</h1>
93 <p>Overview of available key layouts with AltGr or similar modifier keys.</p>
96 my @sample = split /(?<!\+)/, $get{sample} // 'asSci1!+1';
97 require Shiar_Sheet::Keyboard;
98 use List::Util qw( uniq max );
101 legacy => "\N{TOP HAT}",
102 windows => "\x{1FA9F}", # \N{WINDOW}
103 macos => "\N{RED APPLE}",
104 xorg => "\N{PENGUIN}",
107 printf '<section class="%s">', @sample ? 'section' : 'gallery';
109 print '<table class="big keys cmp">';
110 print '<thead><tr><th colspan=2>';
111 print "<th>$_" for @sample;
114 my %idx = map {s/\Q.inc.pl\E$//; ($_ => eval{ Data($_) })} @incs;
115 my $most = max(map { scalar keys %{$_->{def}{''}} } values %idx);
117 $idx{$a}{category} cmp $idx{$b}{category} || $a cmp $b
119 print @sample ? '<tr><th>' : '<figure>';
120 printf '<a href="/%s">', $inc =~ s/\.eng$//r;
121 my $table = $idx{$inc};
122 my $title = $table && $table->{title} || $inc;
125 if ($table and my $img = $table->{image}) {
126 EscapeHTML $name = $table->{imagealt} // $img =~ m{.*/([^/.]*)};
127 print qq{<img src="/$img" alt="$name" />};
129 printf '<figcaption>%s</figcaption>', $title;
134 print '</a>', "\n\t";
135 my $keys = Shiar_Sheet::Keyboard->new($table);
136 for my $mode ($keys->{mode} ? sort keys %{ $keys->{mode} } : '') {
138 $inventory{ s/ (?!ext).*//r }++ for values %{ $keys->{def}{$mode} };
139 print '<span class=graph>';
140 print "<label>$_</label>" for $keys->{key}{$mode} =~ s/\s.*//r || ();
141 for my $g (sort keys %inventory) {
142 printf '<span class="%s" style="width:%.0f%%" title="%3$d %4$s"> %s</span>',
143 $g, $_/$most*100, $_,
145 $keys->{flag}{$_}[0] || 'extra' # legend label of each class
146 } reverse split / /, $g)
152 print join '<br>', map { $caticon{$_} // () } split m{/}, $keys->{category};
154 $keys->print_key('', $_, $keys->{def}{''}{$_} // 'ni') for @sample;
158 print '</table>' if @sample;