X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/78ab2cc012e8290671af6f601d78ba3530dab3aa..23f7b10a8432caad3dc2e5ea875dd76757d2bea4:/keyboard/altgr/groups.inc.pl diff --git a/keyboard/altgr/groups.inc.pl b/keyboard/altgr/groups.inc.pl index 036a21f..2968e4b 100644 --- a/keyboard/altgr/groups.inc.pl +++ b/keyboard/altgr/groups.inc.pl @@ -1,20 +1,21 @@ -use strict; +use 5.020; use warnings; +use experimental 'signatures'; use Unicode::Normalize qw( NFKD ); use Text::Unidecode qw( unidecode ); use Shiar_Sheet::FormatChar; -our %rows; - my $uc = Shiar_Sheet::FormatChar->new; -my %g; # present group classes -{ + +sub kbchars ($rows) { + my %g; # present group classes + return { rows => [1, 0], def => { '' => { map { - my $v = $rows{$_}; - my $class = ( + my $v = $rows->{$_}; + my $class = 'g'.( !defined $v || $_ eq $v ? 1 # identical : $v =~ /\A\p{Mn}+\z/ ? 9 # combining accent : $v =~ /\A[\p{Sk}\p{Lm}]+\z/ ? 8 # modifier symbol @@ -25,25 +26,26 @@ my %g; # present group classes : 6 ); $g{$class} = 1; - $_ => "g$class" - } keys %rows + $_ => $class + } keys %{$rows} }, }, key => { map { - my ($glyph, $title) = $uc->glyph_html($rows{$_}); + my ($glyph, $title) = $uc->glyph_html($rows->{$_}); $_ => join "\n", $glyph, $title - } keys %rows + } keys %{$rows} }, - flag => { + flag => {%{{ g2 => ['accented', "decomposes to the original letter with a combining accent"], g4 => ['similar', "transliterates (mostly) into the unmodified letter"], g5 => ['latin', "a different (accented) latin letter"], g6 => ['symbol', "other character not directly deducible from key"], g7 => ['punctuation', "(punctuation) mark"], - !$g{9} ? () : ( g8 => ['mark', "modifier letter or mark (spacing diacritic)"], g9 => ['combining', "diacritical mark to be combined with a following character"], - ), - }, + }}{keys %g}}, + }; } + +1;