Html({
title => "altgr keyboard cheat sheets",
- version => '1.0',
+ version => '1.1',
description => [
"Overview of alternate keyboard modes,",
"offering extended Unicode characters if a modifier key",
keywords => [qw'
sheet cheat reference overview keyboard altgr option
'],
+ image => 'data/keyboard/thumb/ibm-m.jpg',
stylesheet => [qw( light dark circus mono red )],
data => ['keyboard/altgr/index.inc.plp', @incs],
raw => <<'.',
<style>
+.keys.cmp {
+ display: inline-table; /* centered */
+ float: none;
+ margin: 0;
+ border-collapse: separate;
+ border-spacing: 2px;
+ border-spacing: .4vw; /* inline td margin equivalent */
+}
+.keys.big.cmp tbody {
+ font-size: 150%;
+}
+.keys.cmp tbody {
+ display: table-row-group;
+}
+.keys.cmp tr {
+ display: table-row;
+}
+.keys.cmp tr > * {
+ display: table-cell;
+ position: static; /* under sticky thead */
+}
+.keys.cmp tbody th {
+ padding-right: 1ex;
+ text-align: right;
+}
+
img {
object-fit: cover;
height: 100%;
+ vertical-align: middle;
}
</style>
.
:>
<h1>Extended keyboards</h1>
-<p>Representative images of available layouts
-with AltGr or similar modifier keys.</p>
+<p>Overview of available key layouts with AltGr or similar modifier keys.</p>
+
+<:
+my @sample = split /(?<!\+)/, $get{sample} // 'asSci1!+1';
+require Shiar_Sheet::Keyboard;
-<section class="gallery"><:
-for my $inc (@incs) {
- $inc =~ s/\Q.inc.pl\E$//;
- print '<figure>';
+printf '<section class="%s">', @sample ? 'section' : 'gallery';
+if (@sample) {
+ print '<table class="big keys cmp">';
+ print '<thead><tr><th>';
+ print "<th>$_" for @sample;
+ say '</tr></thead>';
+}
+my %idx = map {s/\Q.inc.pl\E$//; ($_ => eval{ Data($_) })} @incs;
+for my $inc (sort {
+ $idx{$a}{category} cmp $idx{$b}{category} || $a cmp $b
+} keys %idx) {
+ print @sample ? '<tr><th>' : '<figure>';
printf '<a href="/%s">', $inc =~ s/\.eng$//r;
- if (my $table = eval { Data($inc) }) {
- printf '<img src="/%s" />', $_ for $table->{image} || ();
- $inc = $table->{title};
+ my $table = $idx{$inc};
+ my $title = $table && $table->{title} || $inc;
+
+ unless (@sample) {
+ if ($table and my $img = $table->{image}) {
+ EscapeHTML $name = $table->{imagealt} // $img =~ m{.*/([^/.]*)};
+ print qq{<img src="/$img" alt="$name" />};
+ }
+ printf '<figcaption>%s</figcaption>', $title;
+ say '</a></figure>';
+ }
+ else {
+ print $title;
+ print '</a>';
+ my $keys = Shiar_Sheet::Keyboard->new($table);
+ print '<br>', join(' ', map { $keys->{key}{$_} =~ s/\s.*//r } grep {$_} keys %{$_})
+ for $keys->{mode} || ();
+ $keys->print_key('', $_, $keys->{def}{''}{$_} // 'ni') for @sample;
+ say '</tr>';
}
- printf '<figcaption>%s</figcaption>', $inc;
- say '</a></figure>';
}
+print '</table>' if @sample;
:></section>