sc: lotv patch v5.0.12 (2023-09-29)
[sheet.git] / writing.plp
1 <(common.inc.plp)><:
2
3 my $source = lc $Request || 'phnx';
4 $source =~ s/^brah\Kmi$//;
5 my $include = "writing-$source";
6
7 my $info = eval { Data($include) } || {};
8
9 Html({
10         title => $info->{pagetitle} || "$info->{title} scripts comparison sheet",
11         version => $info->{version} || '0.1',
12         description => $info->{description},
13         keywords => [@{ $info->{keywords} // []}, qw(
14                 writing script glyph unicode character letter comparison history
15                 alphabet sample test language multilingual
16         )],
17         data => ["$include.inc.pl"],
18 });
19
20 my $rows = $info->{list} or Abort(
21         "Requested script parent <q>$source</q> not available",
22         '404 request not found',
23 );
24
25 say "<h1>\u$info->{title} scripts</h1>";
26 say "<p>$_</p>" for $info->{intro} || ();
27 say '<div class="section">';
28
29 use Shiar_Sheet::FormatChar;
30 my $glyphs = Shiar_Sheet::FormatChar->new;
31 unless (exists $get{v}) {
32         $glyphs->{unicode}--;
33         $glyphs->{anno}  = [];
34         $glyphs->{style} = 'univer';
35 }
36
37 my $scriptname = eval { Data('writing-script') }; # optional translations
38 $_ = showlink($_, "/latin") for $scriptname->{latn} || ();
39 $_ = showlink($_, "/writing/brahmi") for $scriptname->{brah} || ();
40
41 say $glyphs->table([map {
42         my $lead = s/^(-)// && $1;
43         (map { ".>$lead$_" }
44                 $scriptname->{$source.'_'.$_} || $scriptname->{$_} || $_
45         ),
46         @{ $info->{table}->{$_} || [] }
47 } @{$rows}]);
48
49 say "</div>\n";
50
51 say for '<hr/>', $glyphs->legend;
52