charset: exceptionally inherit MacCroatian from MacRomanian
[sheet.git] / apl.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'APL',
5         version => '1.0',
6         description => [
7         ],
8         keywords => [qw'
9         '],
10         stylesheet => [qw'light circus dark red'],
11         data => [qw'apl.inc.pl'],
12         raw => <<'EOT',
13 <style>
14         .target tbody td:nth-child(4) ~ td,
15         :target tbody td:nth-child(4) ~ td {
16                 text-align: left;
17         }
18         .target tbody td[title]::after,
19         :target tbody td[title]::after {
20                 content: ': ' attr(title);
21                 font-size: 75%;
22                 opacity: .7;
23         }
24 </style>
25 EOT
26 });
27
28 use Shiar_Sheet::FormatChar;
29 my $glyphs = Shiar_Sheet::FormatChar->new;
30
31 my @ops = do 'apl.inc.pl';
32 @ops > 1 or die "cannot open operator include: $@\n";
33
34 :>
35 <h1>APL Symbols</h1>
36
37 <div class="section">
38 <table class="mapped" onclick="this.classList.toggle('target')">
39         <col><colgroup span=3><colgroup span=2>
40 <thead><tr>
41         <td rowspan=2>op
42         <td colspan=3>input
43         <td colspan=2>meaning
44 <tr>
45         <td title="unified/Dyalog key combination">⎈
46         <td><a href="/digraphs" title="digraph">di</a><td>html
47         <td title="…B">monadic
48         <td title="A…B">dyadic
49 <tbody>
50
51 <:
52 for my $op (@ops) {
53         $op or do {
54                 say '<tbody>';
55                 next;
56         };
57
58         my ($chr, $dyad, $monad) = @{$op};
59         ($chr, my $altkey) = split /\n/, $chr;
60         my $codepoint = ord $chr;
61         my $ascii = $codepoint <= 127;
62         my $info = $glyphs->glyph_info($codepoint);
63         my ($class, $name, $mnem, $entity, $string) = @{$info};
64
65         printf '<tr><th title="%2$s">%s', $chr, EscapeHTML($name || '?'), $class;
66         printf '<td class="%s">%s', @{$_} for (
67                 [$ascii ? 'l5' : defined $altkey ? 'l4' : 'l3', $altkey],
68                 [defined $mnem ? $class =~ /\bu-di\b/ ? 'l4' : 'l3' : $ascii ? 'l5' : 'l1',
69                         EscapeHTML($mnem) // sprintf('%s%0*X', $codepoint < 256 ? (x => 2) : (u => 4), $codepoint)],
70                 [defined $entity ? 'l4' : $ascii ? 'l5' : 'l1', $entity // "#$codepoint"],
71         );
72         printf(
73                 defined $_ ? '<td%s>%s' : '<td class=Xi>',
74                 map { !!$_->[1] && qq( title="$_->[1]"), $_->[0] }
75                 [map { EscapeHTML($_) } split /\n/, $_, 2]
76         ) for $monad, $dyad;
77         say '</td>';
78 }
79
80 :></table>
81 </div>
82
83 <hr>
84
85 <div class="legend">
86         <table class="glyphs"><tr>
87         <td class="X l5">unicode 1.1
88         <td class="X l4">20th century
89         <td class="X l3">in 6.0 (2010)
90         <td class="X l2">recent assignments
91         <td class="X l1">proposed
92         <td class="ex">irregular
93         </table>
94 </div>
95