X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/b13bb406f89eaebf04c8fd8ffe69cde30d5aa0bd..f4377fa7ab32ce088460551744de22bab93515dc:/Shiar_Sheet/KeyboardChars.pm diff --git a/Shiar_Sheet/KeyboardChars.pm b/Shiar_Sheet/KeyboardChars.pm index d0e84c8..5301185 100644 --- a/Shiar_Sheet/KeyboardChars.pm +++ b/Shiar_Sheet/KeyboardChars.pm @@ -9,7 +9,7 @@ use Unicode::Normalize qw( NFKD ); use Text::Unidecode (); use Shiar_Sheet::FormatChar; -our $VERSION = '1.04'; +our $VERSION = '1.05'; our @EXPORT = qw( kbchars kbmodes ); my $uc = Shiar_Sheet::FormatChar->new; @@ -48,11 +48,17 @@ sub kbmodes ($modes) { $info{def}->{$lead}{$lead} = 'g1 mode'; # back } while (my ($k, $v) = each %{ $modes->{$lead} }) { + my @class; + if (ref $v eq 'SCALAR') { + my ($reflead, $ref) = split /(.)$/, ${$v}; + $v = $modes->{$reflead}->{$ref}; + @class = 'ext'; + } my ($glyph, $title) = $uc->glyph_html($v); $info{key}{$lead.$k} = join "\n", $glyph, $title; my $c = $k =~ s/\A[+^](?=.)//r; # trim modifier indicator - my $class = ( + unshift @class, ( !defined $v || $c eq $v ? 'no' # identical : $v =~ /\A\p{Mn}+\z/ ? 'g9' # combining accent : NFKD($v) =~ /\A\Q$c\E\p{Mn}*\z/ ? 'g2' # decomposed equivalent @@ -62,8 +68,8 @@ sub kbmodes ($modes) { : $v =~ /^\p{Latin}/ ? 'g5' # latin script : 'g6' ); - $g{$class} = 1 unless $class eq 'no'; - $info{def}{$lead}{$k} //= $class; + $g{$_} = 1 for grep { $_ ne 'no' } @class; + $info{def}{$lead}{$k} //= join ' ', @class; } } $info{flag} = {%{{ @@ -75,6 +81,7 @@ sub kbmodes ($modes) { g7 => ['punctuation', "(punctuation) mark"], g8 => ['mark', "modifier letter or mark (spacing diacritic)"], g9 => ['combining', "diacritical mark to be combined with a following character"], + ext => ['alias', 'alternative with identical results as something else'], }}{keys %g}}; return \%info; }