X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/d633423013d3cfb34c674454fa402a11561c2eac..f1cfafd56c8fc6be24d8691daf40a9fbff767b17:/keyboard/altgr/index.inc.plp diff --git a/keyboard/altgr/index.inc.plp b/keyboard/altgr/index.inc.plp index e4ed3d8..9e4d6b5 100644 --- a/keyboard/altgr/index.inc.plp +++ b/keyboard/altgr/index.inc.plp @@ -1,12 +1,13 @@ <: # 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.0', + version => '1.2', description => [ "Overview of alternate keyboard modes,", "offering extended Unicode characters if a modifier key", @@ -15,13 +16,92 @@ Html({ 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 => <<'.', . @@ -30,25 +110,74 @@ img { :>

Extended keyboards

-

Representative images of available layouts -with AltGr or similar modifier keys.

+

Overview of available key layouts with AltGr or similar modifier keys.

+ +<: +my @sample = split /(?<: +my %caticon = ( + legacy => 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 ''; +} 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 + ($idx{$a}{category} // 0) cmp ($idx{$b}{category} // 0) + || $a cmp $b } keys %idx) { - print '
'; + print @sample ? '
'; } - printf '
%s
', $inc; - say ''; } +print '
'; + print "$_" for @sample; + say '
' : '
'; printf '', $inc =~ s/\.eng$//r; - if ($table = $idx{$inc}) { - if (my $img = $table->{image}) { + 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{$name}; } - $inc = $table->{title}; + printf '
%s
', $title; + say '
'; + } + 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 '
' if @sample; :>