From: Mischa POSLAWSKY
Date: Sat, 14 May 2022 15:41:13 +0000 (+0200)
Subject: latin: group aliases similar to termcol ea
X-Git-Url: http://git.shiar.net/sheet.git/commitdiff_plain/f00f148c4e56bde702d316dd591934adbb4f6232
latin: group aliases similar to termcol ea
Replacing pairwise list access for order so the structure can be
represented as a proper hash table.
---
diff --git a/Makefile b/Makefile
index 75f269b..138be91 100644
--- a/Makefile
+++ b/Makefile
@@ -89,7 +89,7 @@ data/wordlist.%.inc.pl: tools/mkwordlist data/wordlist.version.txt
data/word%.json: data/word%.inc.pl
$(call cmdsave,perl -MJSON=encode_json -E "print encode_json(do \$$ARGV[0])" ./$<)
data/%.json: %.inc.pl
- $(call cmdsave,perl -MJSON=encode_json -E "print encode_json([ do \$$ARGV[0] ])" ./$<)
+ $(call cmdsave,perl -MJSON -E "print JSON->new->utf8->canonical->encode(do \$$ARGV[0])" ./$<)
data/wordpairs.inc.pl: data/wordlist.version.txt
@perl -I. -MShiar_Sheet::DB -MData::Dump=pp -E 'say pp(Shiar_Sheet::DB->connect->select("word w JOIN word a ON w.id=a.ref" => "w.id, a.id", {"a.lang"=>undef})->map or exit 1)' >$@
diff --git a/latin.plp b/latin.plp
index cac0e92..70c9b05 100644
--- a/latin.plp
+++ b/latin.plp
@@ -48,28 +48,35 @@ Also see related alphabets
and font comparison.
<:
-use List::Util qw( pairs );
-
-my @table = Data('writing-latn');
+my $table = Data('writing-latn');
{
say '';
say '\n";
+}
- my %VOWELCOLS = (map { ($_ => 1) } 0, 4, 8, 14, 20, 24);
- say '
';
- say '# ASCII â 64';
- print ' | ', $_ for 1 .. 26;
- say ' |
';
+my %VOWELCOLS = (map { ($_ => 1) } 0, 4, 8, 14, 20, 24);
+say '';
+say '';
+printtr('order');
+say '';
+printtr('default');
+say "
";
- for my $row (pairs @table) {
- my ($id, $info) = @{$row};
+sub printtr {
+ for my $id (@_) {
+ my $info = $table->{$id};
+
+ if (ref $info eq 'ARRAY') {
+ printtr(@{$info});
+ next;
+ }
printf '', $id;
my $th = 'th';
@@ -105,7 +112,6 @@ my @table = Data('writing-latn');
say;
}
}
- say "
";
}
:>
diff --git a/writing-latn.inc.pl b/writing-latn.inc.pl
index a2dd4b4..806bff2 100644
--- a/writing-latn.inc.pl
+++ b/writing-latn.inc.pl
@@ -151,7 +151,23 @@ sub disphues {
);
}
-(
++{
+default => [qw( written sign digital touch tactile sound games semaphore barcode personal )],
+written => [qw( uppercase lowercase suetterlin roman )],
+digital => [qw( stroke ita2 )],
+stroke => [qw( graffiti unistrokes edgewrite )],
+touch => [qw( moon braille )],
+sign => ['sutton'],
+sound => [qw( morse tap shorttap )],
+games => [qw( domino tetromino cards )],
+semaphore => [qw( maritime flag chappe prussian )],
+barcode => [qw( rm4scc code39 code93 code128 )],
+personal => [qw( rgbmap cmymap dni pigpen nyctographs chromacons )],
+
+order => {
+ name => '#',
+ list => [1 .. 26],
+},
uppercase => {
list => [qw{ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z }],
},
@@ -783,4 +799,4 @@ chromacons => {
}
],
},
-);
+};