X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/d633423013d3cfb34c674454fa402a11561c2eac..dfb97641f69972c016320553556086d5a66e7606:/keyboard/altgr/index.inc.plp
diff --git a/keyboard/altgr/index.inc.plp b/keyboard/altgr/index.inc.plp
index e4ed3d8..208cae2 100644
--- a/keyboard/altgr/index.inc.plp
+++ b/keyboard/altgr/index.inc.plp
@@ -1,12 +1,14 @@
<: # included from keyboard.plp
use 5.014;
use warnings;
+use utf8;
-my @incs = glob 'keyboard/altgr/*.eng.inc.pl';
+my $dirbase = 'keyboard/altgr';
+my $indexfile = "$dirbase/index";
Html({
title => "altgr keyboard cheat sheets",
- version => '1.0',
+ version => '1.2',
description => [
"Overview of alternate keyboard modes,",
"offering extended Unicode characters if a modifier key",
@@ -15,13 +17,92 @@ Html({
keywords => [qw'
sheet cheat reference overview keyboard altgr option
'],
+ image => "$dirbase/thumb/ibm-m.jpg",
stylesheet => [qw( light dark circus mono red )],
- data => ['keyboard/altgr/index.inc.plp', @incs],
+ data => ["$dirbase/index.inc.plp", "$indexfile.inc.pl"],
raw => <<'.',
.
@@ -30,25 +111,75 @@ img {
:>
Extended keyboards
-Representative images of available layouts
-with AltGr or similar modifier keys.
-
-<:
-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 '';
- printf '', $inc =~ s/\.eng$//r;
- if ($table = $idx{$inc}) {
- if (my $img = $table->{image}) {
+Overview of available key layouts with AltGr or similar modifier keys.
+
+<:
+my $idx = Data($indexfile);
+my @incs;
+push @incs, @{ $idx->{$_} } for @{ $idx->{default} };
+
+my @sample = split /(? qq{\N{TOP HAT}},
+ windows => qq{\x{1FA9F}}, # \N{WINDOW}
+ macos => qq{\N{RED APPLE}},
+ xorg => qq{\N{PENGUIN}},
+);
+
+printf '', @sample ? 'section' : 'gallery';
+if (@sample) {
+ print '';
+ print '';
+ print " | $_" for @sample;
+ say ' |
';
+}
+my %idx = map {($_ => scalar eval{ Data("$dirbase/$_.eng") })} @incs;
+my $most = max(map { scalar keys %{$_->{def}{''}} } values %idx);
+for my $inc (@incs) {
+ print @sample ? '' : '';
+ }
+ else {
+ print $title;
+ print '', "\n\t";
+ my $keys = Shiar_Sheet::Keyboard->new($table);
+ 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 '';
+ printf '', s/\s.*//r for $keys->{key}{$mode} || ();
+ for my $g (sort keys %inventory) {
+ printf ' %s',
+ $g, $_/$most*100, $_,
+ join(' ', map {
+ $keys->{flag}{$_}[0] || 'extra' # legend label of each class
+ } reverse split / /, $g)
+ for $inventory{$g};
+ }
+ say '';
+ }
+ print "\t | ";
+ print join ' ', map { $caticon{$_} // () } split m{/}, $keys->{category} // '';
+ say '';
+ $keys->print_key('', $_, ($keys->{def}{''}{$_} // 'ni') =~ s/ mode\S*//r)
+ for @sample;
+ say ' |
';
}
- printf '%s', $inc;
- say '';
}
+print '
' if @sample;
:>