index: release v1.18 with only altgr index linked
[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 my $ops = Data('apl');
31
32 :>
33 <h1>APL Symbols</h1>
34
35 <div class="section">
36 <table class="mapped" onclick="this.classList.toggle('target')">
37         <col><colgroup span=3><colgroup span=2>
38 <thead><tr>
39         <td rowspan=2>op
40         <td colspan=3>input
41         <td colspan=2>meaning
42 <tr>
43         <td title="unified/Dyalog key combination">⎈
44         <td><a href="/digraphs" title="digraph">di</a><td>html
45         <td title="…B">monadic
46         <td title="A…B">dyadic
47 <tbody>
48
49 <:
50 for my $op (@{$ops}) {
51         $op or do {
52                 say '<tbody>';
53                 next;
54         };
55
56         my ($chr, $dyad, $monad) = @{$op};
57         ($chr, my $altkey) = split /\n/, $chr;
58         my $codepoint = ord $chr;
59         my $ascii = $codepoint <= 127;
60         my $info = $glyphs->glyph_info($codepoint);
61         my ($class, $name, $mnem, $entity, $string) = @{$info};
62
63         printf '<tr><th title="%2$s">%s', $chr, EscapeHTML($name || '?'), $class;
64         printf '<td class="%s">%s', @{$_} for (
65                 [$ascii ? 'l5' : defined $altkey ? 'l4' : 'l3', $altkey],
66                 [defined $mnem ? $class =~ /\bu-di\b/ ? 'l4' : 'l3' : $ascii ? 'l5' : 'l1',
67                         EscapeHTML($mnem) // sprintf('%s%0*X', $codepoint < 256 ? (x => 2) : (u => 4), $codepoint)],
68                 [defined $entity ? 'l4' : $ascii ? 'l5' : 'l1', $entity // "#$codepoint"],
69         );
70         printf(
71                 '<td%s>%s',
72                 map { defined ? (!!$_->[1] && qq( title="$_->[1]"), $_->[0]) : (' class=Xi', '') }
73                 $_ && [map { EscapeHTML($_) } split /\n/, $_, 2]
74         ) for $monad, $dyad;
75         say '</td>';
76 }
77
78 :></table>
79 </div>
80
81 <:
82 say for '<hr/>', $glyphs->legend;
83