index: release v1.18 with only altgr index linked
[sheet.git] / writing.plp
index 4187d017646eeed06060524eef0218c3ac90729a..dfd78a4a77835f5943dd039b9a5abcc23dbc709d 100644 (file)
 <(common.inc.plp)><:
 
+my $source = lc $Request || 'phnx';
+$source =~ s/^brah\Kmi$//;
+my $include = "writing-$source";
+
+my $info = eval { Data($include) } || {};
+
 Html({
-       title => 'writing system inheritance sheet',
-       version => 'v1.0',
-       description => [
-               "Character comparison,",
-               "tracking letters as they evolve from Phoenician to modern scripts.",
-               "Good Unicode test sample.",
-       ],
-       keywords => [qw'
-               script glyph unicode writing comparison character alphabet letter
-               history phoenician latin sample test language multilingual
-       '],
-       stylesheet => [qw'light dark red'],
+       title => $info->{pagetitle} || "$info->{title} scripts comparison sheet",
+       version => $info->{version} || '0.1',
+       description => $info->{description},
+       keywords => [@{ $info->{keywords} // []}, qw(
+               writing script glyph unicode character letter comparison history
+               alphabet sample test language multilingual
+       )],
+       stylesheet => [qw'light circus dark red mono'],
+       data => ["$include.inc.pl"],
 });
 
-:>
-<h1>Writing systems</h1>
-
-<p>Also see <a href="/charset">charsets</a>
-and <a href="/unicode">common chars</a>.</p>
+my $rows = $info->{list} or Abort(
+       "Requested script parent <q>$source</q> not available",
+       '404 request not found',
+);
 
-<div class="section">
+say "<h1>\u$info->{title} scripts</h1>";
+say "<p>$_</p>" for $info->{intro} || ();
+say '<div class="section">';
 
-<:
 use Shiar_Sheet::FormatChar;
 my $glyphs = Shiar_Sheet::FormatChar->new;
 unless (exists $get{v}) {
        $glyphs->{unicode}--;
-       $glyphs->{digraph}--;
+       $glyphs->{anno}  = [];
+       $glyphs->{style} = 'univer';
 }
 
-my %scriptname = (
-       arab     => 'Arabic',
-       armi     => 'Aramaic',
-       bali     => 'Balinese',
-       beng     => 'Bengali',
-       brah     => 'Brahmi',
-       cham     => 'Cham',
-       copt     => 'Coptic',
-       cyrl     => 'Cyrillic',
-       deva     => 'Devanagari',
-       ethi     => 'Ethiopic',
-       goth     => 'Gothic',
-       grek     => 'Greek',
-       gujr     => 'Gujarati',
-       guru     => 'Gurmukhi', # ਪੰਜਾਬੀ     ੧
-       hans     => 'Chinese',
-       hant     => 'Chinese',
-       hebr     => 'Hebrew',
-       ipa      => 'IPA',
-       iso      => 'ISO',
-       ital     => 'Old_Italic',
-       java     => 'Javanese',
-       kali     => 'Kayah_Li',
-       khmr     => 'Khmer',
-       knda     => 'Kannada',
-       lana     => 'Tai_Tham',
-       laoo     => 'Lao',
-       latn     => '<a href="/latin">Latin</a>',
-       lepc     => 'Lepcha',
-       lyci     => 'Lycian',
-       lydi     => 'Lydian',
-       mlym     => 'Malayalam', # മലയാളം   ൧
-       mymr     => 'Myanmar',
-       olck     => 'Ol_Chiki',
-       orya     => 'Oriya', # ଓଡ଼ିଆ
-       osma     => 'Osmanya',
-       phnx     => 'Phoenician',
-       samr     => 'Samaritan',
-       saur     => 'Saurashtra',
-       sinh     => 'Sinhala',
-       sund     => 'Sundanese',
-       syrc     => 'Syriac',
-       talu     => 'New_Tai_Lue',
-       taml     => 'Tamil', # தமிழ்         ௧
-       telu     => 'Telugu',
-       teng     => 'Tengwar',
-       tglg     => 'Baybayin',
-       thai     => 'Thai', # ไทย
-       tibt     => 'Tibetan',
-       tlh      => 'Klingon',
+my $scriptname = eval { Data('writing-script') }; # optional translations
+$_ = showlink($_, "/latin") for $scriptname->{latn} || ();
+$_ = showlink($_, "/writing/brahmi") for $scriptname->{brah} || ();
 
-       digits_latn     => 'Arabic_(Western)',
-       digits_latnlat  => 'Roman',
-       digits_brai     => 'Braille_[⠼+]',
-              arabindi => 'Arabic_-_Indic',
-              arabpers => 'Arabic_-_Indic_(Alt)',
-       digits_brahnumb => 'Brahmi',
-              lanahora => 'Tai_Tham_Hora',
-              suzhou   => 'Hangzhou',
-);
-
-for (
-       [phnx => 'Phoenician'],
-       [brah => 'Brahmi'],
-       [digits => 'Digits'],
-) {
-       my ($source, $title) = @$_;
-       my @table = do "writing-$source.inc.pl";
-       if ($! or $@) {
-               print "<h2>$title</h2>\n";
-               printf "<p>Table data not found: <em>%s</em>.</p>\n", $! || $@;
-               next;
-       }
-       $glyphs->print($title => [map {
-               ref $_ eq 'ARRAY' ? @$_ : map { ".>$_" }
-                       $scriptname{$source.'_'.$_} || $scriptname{$_} || $_
-       } @table]);
-}
+say $glyphs->table([map {
+       my $lead = s/^(-)// && $1;
+       (map { ".>$lead$_" }
+               $scriptname->{$source.'_'.$_} || $scriptname->{$_} || $_
+       ),
+       @{ $info->{table}->{$_} || [] }
+} @{$rows}]);
 
-:></div>
+say "</div>\n";
 
-<hr>
+say for '<hr/>', $glyphs->legend;