keyboard/altgr: move code include to project packages
[sheet.git] / keyboard / altgr / groups.inc.pl
diff --git a/keyboard/altgr/groups.inc.pl b/keyboard/altgr/groups.inc.pl
deleted file mode 100644 (file)
index 6afd7dc..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-package Shiar_Sheet::KeyboardChars;
-
-use 5.020;
-use warnings;
-use experimental 'signatures';
-use parent 'Exporter';
-use Unicode::Normalize qw( NFKD );
-use Text::Unidecode qw( unidecode );
-use Shiar_Sheet::FormatChar;
-
-our $VERSION = '1.00';
-our @EXPORT = qw( kbchars kbmodes );
-
-my $uc = Shiar_Sheet::FormatChar->new;
-
-sub kbchars ($rows) {
-       return kbmodes({'' => $rows});
-}
-
-sub kbmodes ($modes) {
-       my %g; # present group classes
-       my %info = (
-               rows => [1, 0],
-       );
-       for my $lead (keys %{$modes}) {
-               if ($lead ne '') {
-                       $info{def}->{''}->{$lead} = "g1 mode$lead";
-                       $g{g1} = 1;
-                       $info{mode}->{$lead} //= "mode $lead";
-                       $info{def}->{$lead}{$lead} = 'g1 mode'; # back
-               }
-               while (my ($c, $v) = each %{ $modes->{$lead} }) {
-                       my ($glyph, $title) = $uc->glyph_html($v);
-                       $info{key}{$lead.$c} = join "\n", $glyph, $title;
-
-                       my $class = 'g'.(
-                                 !defined $v || $c eq $v ? 1 # identical
-                               : $v =~ /\A\p{Mn}+\z/ ? 9 # combining accent
-                               : $v =~ /\A[\p{Sk}\p{Lm}]+\z/ ? 8 # modifier symbol
-                               : $v =~ /\A[\pM\pP]+\z/ ? 7 # mark
-                               : NFKD($v) =~ /\Q$c/ ? 2 # decomposed equivalent
-                               : unidecode($v) =~ /\Q$c\E+/i ? 4 # transliterated
-                               : $v =~ /^\p{Latin}/ ? 5 # latin script
-                               : 6
-                       );
-                       $g{$class} = 1;
-                       $info{def}{$lead}{$c} //= $class;
-               }
-       }
-       $info{flag} = {%{{
-               g1 => ['mode' => "switch to an alternate set of keys"],
-               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"],
-               g8 => ['mark', "modifier letter or mark (spacing diacritic)"],
-               g9 => ['combining', "diacritical mark to be combined with a following character"],
-       }}{keys %g}};
-       return \%info;
-}
-
-1;