digits: group rows into table presets
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 18 Apr 2017 22:23:21 +0000 (00:23 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 25 May 2017 20:10:22 +0000 (22:10 +0200)
digits.plp
writing-digits.inc.pl

index bc435932e622727cbf2307330c018b19a3af494e..6666b8f3f52aab0d933b35bfaae54a5da0cf85f7 100644 (file)
@@ -13,6 +13,11 @@ Html({
        )],
        stylesheet => [qw( light dark circus mono red )],
        data => [qw'writing-digits.inc.pl'],
        )],
        stylesheet => [qw( light dark circus mono red )],
        data => [qw'writing-digits.inc.pl'],
+       raw => <<'EOT',
+<style>
+th:first-child { min-width: 10em }
+</style>
+EOT
 });
 
 :>
 });
 
 :>
@@ -24,7 +29,6 @@ in various <a href="/writing">writing systems</a>.</p>
 <div>
 
 <:
 <div>
 
 <:
-use List::Util qw( pairs );
 use Shiar_Sheet::FormatChar 1.08;
 my $glyphs = Shiar_Sheet::FormatChar->new;
 unless (exists $get{v}) {
 use Shiar_Sheet::FormatChar 1.08;
 my $glyphs = Shiar_Sheet::FormatChar->new;
 unless (exists $get{v}) {
@@ -36,16 +40,20 @@ unless (exists $get{v}) {
 my $scriptname = do 'writing-script.inc.pl';
 $_ = qq{<a href="/latin">$_</a>} for $scriptname->{latn} || ();
 
 my $scriptname = do 'writing-script.inc.pl';
 $_ = qq{<a href="/latin">$_</a>} for $scriptname->{latn} || ();
 
-my @table = do "writing-digits.inc.pl";
+my %table = do "writing-digits.inc.pl";
 die "Table data not found: $_\n" for $@ || $! || ();
 
 die "Table data not found: $_\n" for $@ || $! || ();
 
-say $glyphs->tabletag;
-for my $row (pairs @table) {
-       my ($id, $info) = @{$row};
-       my $title = $info->{title} // $scriptname->{$id} || $id;
-       print $glyphs->row([ ".>$title", @{$info->{list}} ]);
+sub printtable {
+       say '<div class=section>', $glyphs->tabletag;
+       for my $id (@_) {
+               my $info = $table{$id};
+               my $title = $info->{title} // $scriptname->{$id} || $id;
+               print $glyphs->row([ ".>$title", @{$info->{list}} ]);
+       }
+       say '</table></div>';
 }
 }
-say '</table>';
+
+printtable(@{ $table{$_} }) for @{ $table{default} };
 
 :></div>
 
 
 :></div>
 
index 63e2af59a564604a561ed9255495ac3e9e74e4a5..5418be52dc941990bf66e02cff32c9853b4f59d8 100644 (file)
@@ -1,5 +1,14 @@
 use utf8;
 (
 use utf8;
 (
+default  => [qw( brahmi western sign eastern )],
+eastern  => [qw( hant hans suzhou rod )],
+brahmi   => [qw(
+       khmr java bali sund talu lana lanahora laoo mlym taml cham kali mymr cakm
+       thai knda telu tibt lepc beng olck saur orya guru gujr deva brahnumb brah
+)],
+western  => [qw( arabindi arabpers ethi copt latn latnlat xsux maya teng tlh osma brai )],
+sign     => [qw( suttus suttbe suttnl )],
+
 hant     => {list => [qw{ >- 壹 貳 參 肆 伍 陸 柒 捌 玖 零 }]},
 hans     => {list => [qw{ 〇 一 二 三 四 五 六 七 八 九 十 }]},
 suzhou   => {list => [qw{ >- 〡 〢 〣 〤 〥 〦 〧 〨 〩 〸 }], title => 'Suzhou'},
 hant     => {list => [qw{ >- 壹 貳 參 肆 伍 陸 柒 捌 玖 零 }]},
 hans     => {list => [qw{ 〇 一 二 三 四 五 六 七 八 九 十 }]},
 suzhou   => {list => [qw{ >- 〡 〢 〣 〤 〥 〦 〧 〨 〩 〸 }], title => 'Suzhou'},