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;
$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
: $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} = {%{{
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;
}
']' => "}",
'^' => "\N{COMBINING MACRON}",
'_' => "\xB1",
- '`' => "\xA3",
+ '`' => \'l',
'A' => "\x{2190}",
'a' => "\xE6",
'B' => "\x{20bf}",
'd' => "\x{394}",
'D' => "\x{2192}",
'e' => "\x{20AC}",
- 'E' => "\x{20AC}",
+ 'E' => \'e',
'f' => "\x{192}",
'F' => "\x{191}",
#'g' => "g",
'x' => "\xD7",
'X' => "\xF7",
'y' => "\xA5",
- 'Y' => "\xA5",
+ 'Y' => \'y',
'z' => "\xA7",
'Z' => "\xB6",
'{' => "\xAB",
';' => "\xA1", # unshifted ! at m
);
-my $groups = kbchars(\%rows);
-$groups->{def}{''}{$_} .= ' ext' for qw( ` E Y );
-
+{
- %{$groups},
+ %{ kbchars(\%rows) },
version => '1.0',
title => 'Drix',
category => 'latin/xorg',
qw( { [ } ] " ' | \ < , > . ? / ` 3 ~ = ),
(map {uc, lc} qw[ r t y u i o p h j m ]),
);
-$rows{$_} = $rows{ $shift{$_} } for keys %shift; # alias shifted
+$rows{$_} = \$shift{$_} for keys %shift; # alias shifted
my $groups = kbchars(\%rows);
$groups->{flag}{ext} = ['alias', 'identical results from unshifted key'];
-$groups->{def}{''}{$_} .= ' ext' for keys %shift; # mark aliases
+{
%{ $groups },