index: release v1.18 with only altgr index linked
[sheet.git] / writing.plp
index a718c884bd6a1c8ffab718bc7107a32d3a793c73..dfd78a4a77835f5943dd039b9a5abcc23dbc709d 100644 (file)
@@ -1,32 +1,32 @@
 <(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 => '1.2',
-       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
-       '],
+       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 => [qw'writing-phnx.inc.pl'],
+       data => ["$include.inc.pl"],
 });
 
-:>
-<h1>Writing systems</h1>
-
-<p>
-Comparison of Unicode letters in related alphabets.
-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}) {
@@ -35,39 +35,19 @@ unless (exists $get{v}) {
        $glyphs->{style} = 'univer';
 }
 
-my $scriptname = do 'writing-script.inc.pl';
-$_ = qq{<a href="/latin">$_</a>} for $scriptname->{latn} || ();
-
-for (
-       [phnx => 'Phoenician'],
-       [brah => 'Brahmi'],
-) {
-       my ($source, $title) = @$_;
-       my @table = do "writing-$source.inc.pl";
-       if ($! or $@) {
-               say "<h2>$title</h2>";
-               printf "<p>Table data not found: <em>%s</em>.</p>\n", $@ || $!;
-               next;
-       }
-       $glyphs->print($title => [map {
-               my $lead = s/^(-)// && $1;
-               ref $_ eq 'ARRAY' ? @$_ : map { ".>$lead$_" }
-                       $scriptname->{$source.'_'.$_} || $scriptname->{$_} || $_
-       } @table]);
-}
+my $scriptname = eval { Data('writing-script') }; # optional translations
+$_ = showlink($_, "/latin") for $scriptname->{latn} || ();
+$_ = showlink($_, "/writing/brahmi") for $scriptname->{brah} || ();
 
-:></div>
+say $glyphs->table([map {
+       my $lead = s/^(-)// && $1;
+       (map { ".>$lead$_" }
+               $scriptname->{$source.'_'.$_} || $scriptname->{$_} || $_
+       ),
+       @{ $info->{table}->{$_} || [] }
+} @{$rows}]);
 
-<hr>
+say "</div>\n";
 
-<div class="legend">
-       <table class="glyphs"><tr>
-       <td class="X l5">unicode 1.1
-       <td class="X l4">20th century
-       <td class="X l3">in 6.0 (2010)
-       <td class="X l2">recent assignments
-       <td class="X l1">proposed
-       <td class="ex">irregular
-       </table>
-</div>
+say for '<hr/>', $glyphs->legend;