sc: refer to ventral sacs overlord by its common name
[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         data => [qw'apl.inc.pl'],
11         raw => <<'EOT',
12 <style>
13         .target tbody td:nth-child(4) ~ td,
14         :target tbody td:nth-child(4) ~ td {
15                 text-align: left;
16         }
17         .target tbody td[title]::after,
18         :target tbody td[title]::after {
19                 content: ': ' attr(title);
20                 font-size: 75%;
21                 opacity: .7;
22         }
23 </style>
24 EOT
25 });
26
27 use Shiar_Sheet::FormatChar;
28 my $glyphs = Shiar_Sheet::FormatChar->new;
29 my $ops = Data('apl');
30
31 :>
32 <h1>APL Symbols</h1>
33
34 <div class="section">
35 <table class="mapped" onclick="this.classList.toggle('target')">
36         <col><colgroup span=3><colgroup span=2>
37 <thead><tr>
38         <td rowspan=2>op
39         <td colspan=3>input
40         <td colspan=2>meaning
41 <tr>
42         <td title="unified/Dyalog key combination">⎈
43         <td><a href="/digraphs" title="digraph">di</a><td>html
44         <td title="…B">monadic
45         <td title="A…B">dyadic
46 <tbody>
47
48 <:
49 for my $op (@{$ops}) {
50         $op or do {
51                 say '<tbody>';
52                 next;
53         };
54
55         my ($chr, $dyad, $monad) = @{$op};
56         ($chr, my $altkey) = split /\n/, $chr;
57         my $codepoint = ord $chr;
58         my $ascii = $codepoint <= 127;
59         my $info = $glyphs->glyph_info($codepoint);
60         my ($class, $name, $mnem, $entity, $string) = @{$info};
61
62         printf '<tr><th title="%2$s">%s', $chr, EscapeHTML($name || '?'), $class;
63         printf '<td class="%s">%s', @{$_} for (
64                 [$ascii ? 'l5' : defined $altkey ? 'l4' : 'l3', $altkey],
65                 [defined $mnem ? $class =~ /\bu-di\b/ ? 'l4' : 'l3' : $ascii ? 'l5' : 'l1',
66                         EscapeHTML($mnem) // sprintf('%s%0*X', $codepoint < 256 ? (x => 2) : (u => 4), $codepoint)],
67                 [defined $entity ? 'l4' : $ascii ? 'l5' : 'l1', $entity // "#$codepoint"],
68         );
69         printf(
70                 '<td%s>%s',
71                 map { defined ? (!!$_->[1] && qq( title="$_->[1]"), $_->[0]) : (' class=Xi', '') }
72                 $_ && [map { EscapeHTML($_) } split /\n/, $_, 2]
73         ) for $monad, $dyad;
74         say '</td>';
75 }
76
77 :></table>
78 </div>
79
80 <:
81 say for '<hr/>', $glyphs->legend;
82