<: # included from keyboard.plp
use 5.014;
use warnings;
+use utf8;
my @incs = glob 'keyboard/altgr/*.eng.inc.pl';
Html({
title => "altgr keyboard cheat sheets",
- version => '1.1',
+ version => '1.2',
description => [
"Overview of alternate keyboard modes,",
"offering extended Unicode characters if a modifier key",
.keys.big.cmp tbody {
font-size: 150%;
}
+@media (max-width: 48em) {
+ .keys.big.cmp tbody {
+ font-size: 100%;
+ }
+ .keys.big.cmp tbody a {
+ white-space: normal;
+ }
+}
.keys.cmp tbody {
display: table-row-group;
}
text-align: right;
}
+@font-face {
+ font-family: osicons;
+ src: url(/osicon.ttf);
+}
+.icon {
+ font-family: osicons;
+}
+.keys.cmp tbody .ni {
+ font-size: 80%;
+ padding: 0 .2em;
+}
+
+.graph {
+ display: block;
+ line-height: 1ex;
+ height: 1.2ex;
+ margin-top: .4ex;
+}
+.graph ~ .graph {
+ /* subsequent graphs */
+ height: .7ex;
+}
+.graph > * {
+ display: inline-block;
+ height: 100%;
+ vertical-align: top;
+}
+.graph > label {
+ font-size: 75%;
+ margin-right: .2em;
+}
+.graph > span {
+ border: 1px solid #000;
+ border-right-width: 0;
+ font-size: 0;
+}
+.graph > :last-of-type {
+ border-right-width: 1px;
+}
+.graph > .ext {
+ border-left: 0; /* assume following unext */
+}
+
img {
object-fit: cover;
height: 100%;
<:
my @sample = split /(?<!\+)/, $get{sample} // 'asSci1!+1';
require Shiar_Sheet::Keyboard;
+use List::Util qw( uniq max );
+
+my %caticon = (
+ legacy => qq{<span class=icon title="deprecated">\N{TOP HAT}</span>},
+ windows => qq{<span class=icon title="Windows">\x{1FA9F}</span>}, # \N{WINDOW}
+ macos => qq{<span class=icon title="MacOS">\N{RED APPLE}</span>},
+ xorg => qq{<span class=icon title="Xorg">\N{PENGUIN}</span>},
+);
printf '<section class="%s">', @sample ? 'section' : 'gallery';
if (@sample) {
print '<table class="big keys cmp">';
- print '<thead><tr><th>';
+ print '<thead><tr><th colspan=2>';
print "<th>$_" for @sample;
say '</tr></thead>';
}
my %idx = map {s/\Q.inc.pl\E$//; ($_ => eval{ Data($_) })} @incs;
+my $most = max(map { scalar keys %{$_->{def}{''}} } values %idx);
for my $inc (sort {
$idx{$a}{category} cmp $idx{$b}{category} || $a cmp $b
} keys %idx) {
}
else {
print $title;
- print '</a>';
+ print '</a>', "\n\t";
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;
+ for my $mode ($keys->{mode} ? sort keys %{ $keys->{mode} } : '') {
+ my %inventory;
+ $inventory{$_}++ for grep { /^g[2-9]/ } map { s/ (?!ext).*//r }
+ values %{ $keys->{def}{$mode} };
+ print '<span class=graph>';
+ print "<label>$_</label>" for $keys->{key}{$mode} =~ s/\s.*//r || ();
+ for my $g (sort keys %inventory) {
+ printf '<span class="%s" style="width:%.0f%%" title="%3$d %4$s"> %s</span>',
+ $g, $_/$most*100, $_,
+ join(' ', map {
+ $keys->{flag}{$_}[0] || 'extra' # legend label of each class
+ } reverse split / /, $g)
+ for $inventory{$g};
+ }
+ say '</span>';
+ }
+ print "\t<td class=ni>";
+ print join ' ', map { $caticon{$_} // () } split m{/}, $keys->{category};
+ say '';
+ $keys->print_key('', $_, ($keys->{def}{''}{$_} // 'ni') =~ s/ mode\S*//r)
+ for @sample;
say '</tr>';
}
}