From 3cc083e4183098368fcff9130ae670b1661f9e7b Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Fri, 16 Feb 2024 22:01:10 +0100 Subject: [PATCH] keyboard/altgr/index: class inventory count graphs Complete comparison grown out of separate numbers for select classes. --- keyboard/altgr/index.inc.plp | 54 +++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/keyboard/altgr/index.inc.plp b/keyboard/altgr/index.inc.plp index ccb7fb6..0bb7774 100644 --- a/keyboard/altgr/index.inc.plp +++ b/keyboard/altgr/index.inc.plp @@ -6,7 +6,7 @@ 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", @@ -46,6 +46,37 @@ Html({ text-align: right; } +.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%; @@ -63,6 +94,7 @@ img { <: my @sample = split /(?', @sample ? 'section' : 'gallery'; if (@sample) { @@ -72,6 +104,7 @@ if (@sample) { say ''; } 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) { @@ -90,10 +123,23 @@ for my $inc (sort { } else { print $title; - print ''; + print '', "\n\t"; my $keys = Shiar_Sheet::Keyboard->new($table); - print '
', join(' ', map { $keys->{key}{$_} =~ s/\s.*//r } grep {$_} keys %{$_}) - for $keys->{mode} || (); + for my $mode ($keys->{mode} ? sort keys %{ $keys->{mode} } : '') { + my %inventory; + $inventory{ s/ (?!ext).*//r }++ for values %{ $keys->{def}{$mode} }; + print ''; + print "" for $keys->{key}{$mode} =~ s/\s.*//r || (); + 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 ''; + } $keys->print_key('', $_, $keys->{def}{''}{$_} // 'ni') for @sample; say ''; } -- 2.30.0