6546b6659589025dec70e612d192c91a5d851547
[sheet.git] / keyboard / altgr / index.inc.pl
1 use strict;
2 use warnings;
3
4 my %cat = (
5         default => [qw( euro latin science graph )],
6         euro => [qw( windows ukext macos macos-abc weur eurkey msx )],
7         latin => [qw( ipa olpc boyeg drix )],
8         science => [qw( symbolics apl spacecadet )],
9         graph => [qw( unigraph emojiworks )],
10         extra => [qw( msx-graph p8scii zoo )],
11 );
12
13 for my $name (map {@{$_}} values %cat) {
14         my $keys = do "keyboard/altgr/$name.eng.inc.pl" or next;
15         my %row = %{$keys}{qw( title category flag mode image imagealt )};
16         $cat{$name} = \%row;
17
18         $row{mode} //= {'' => undef};
19
20         if (($keys->{moderows} // '') =~ /^\d* [45] \d{2,}/x) {
21                 # move root +meta keys to distinct mode
22                 $row{mode}{"\e"} = '+';
23                 /^\+./ and $keys->{def}{"\e"}{$_} = delete $keys->{def}{''}{$_}
24                         for keys %{ $keys->{def}{''} };
25         }
26
27         for my $mode (keys %{ $row{mode} }) {
28                 $row{inventory}{$mode}{$_}++
29                         for grep { /^g[2-9]/ } map { s/ (?!ext).*//r } map {$_->[0]}
30                         values %{ $keys->{def}{$mode} };
31         }
32 }
33
34 \%cat