index: release v1.18 with only altgr index linked
[sheet.git] / unicode.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'unicode glyph cheat sheet',
5         version => '1.4',
6         description => [
7                 "Common Unicode characters with digraph or code point, layed out for quick location.",
8                 "Includes general symbols, arrows, drawing characters, and IPA letters.",
9         ],
10         keywords => [qw'
11                 unicode glyph char character reference common ipa symbol sign mark table digraph
12         '],
13         stylesheet => [qw'light dark mono circus red'],
14         data => [qw( unicode-table.inc.pl data/unicode-char.inc.pl )],
15 });
16
17 :>
18 <h1>Common Unicode</h1>
19
20 <p>
21 Glyphs are followed by
22 <a href="/digraphs">digraph</a> or <a href="/charset">code point</a>,
23 i^k or i^vu respectively in <a href="/vi">Vim</a>.
24 </p>
25
26 <div class="diinfo">
27
28 <:
29 use Shiar_Sheet::FormatChar;
30 my $glyphs = Shiar_Sheet::FormatChar->new;
31
32 if (exists $get{di}) {
33         $glyphs->{anno} = [ (!defined $get{di} || $get{di}) && 'di', 'hex' ];
34 }
35 if (exists $get{q}) {
36         $glyphs->{anno} = [];
37 }
38 if (exists $get{html}) {
39         $glyphs->{anno} = ['html', 'xml'];
40         $glyphs->{style} = 'html';
41 }
42
43 our $verbose = exists $get{v};
44
45 my @config = qw(
46         Popular
47                 punctuation/quoting
48                         common=-5?common
49                 symbols/binary?symbols/binary=-5
50                 latin/sample=-1
51                         ?sample=2-
52                         ?uncommon
53                 punctuation/version
54                 punctuation/marks
55                         spacing
56         Symbols
57                 symbols/currency
58                         cards=-3?cards
59                         ?chess
60                         harvey
61                         signs1
62                         communic=0?communic
63                         trinity=0?trinity
64                         signs2
65         Signs
66                         solar
67                         ?minorplanets
68                         zodiac=0-1=3?zodiac
69         Key_commands
70                 keys/spacing
71                         editing
72                         modifier
73                         control
74                         command
75                         android=0
76                         ps=0
77                         ?player
78         Mathematics
79                 math/size
80                         equal
81                         set
82                         logic
83         Arrows
84                 arrows/single
85                         double
86                         white
87                         black
88                         triangle
89                         barb
90                         block
91                         blacktri
92                         whitetri
93         Line_drawing
94                 lines/double
95                         doubleh
96                         doublev
97                         single
98                         heavy
99                         heavyh
100                         heavyv
101                         straight
102                         curved
103                         diagonal
104         Blocks
105                 block/square
106                         shades
107                         fill4
108                         fill4i
109                         fill8
110                         colour
111         IPA
112                 ipa/cons
113                         consco
114                         vowels
115                         tones
116                         contours
117         ?Japanese
118                 ?japanese/hira
119                         ?hiraderiv
120                         ?kata
121                         ?kataderiv
122 );
123
124 splice @config, 4, 2, qw(
125                 latin/vowels=-5?latin/vowels
126                          westeuro
127                         ?easteuro
128 ) if exists $get{html};
129
130 $_ and m{/*+(.+)} and @config = split /[ ]/, $1 for $Request, $get{q};
131
132 my $tables = Data('unicode-table');
133
134 $glyphs->print(map {
135         $_ = /(.*)\?(.*)/ ? ($verbose ? $2 : $1) : $_;
136         if (!$_) {
137                 ();
138         }
139         elsif (/[A-Z]/) {
140                 tr/_/ /;
141                 $_;
142         }
143         else {
144                 state $group;
145                 $group = $1 if s{^([^/]+)/}{};
146                 my @select = s/=(.*)// ? split(/=/, $1) : ();
147                 my $table = $tables->{$group}->{$_}
148                         or Abort("Unknown table specified: $group/$_", 404);
149
150                 if (@select) {
151                         my $rowlen;
152                         for ($rowlen = 1; $rowlen <= $#$table; $rowlen++) {
153                                 last if $table->[$rowlen] =~ /\./;
154                         }
155                         my @cells = map {
156                                 my $end = (s/-(.+)?// ? ($1 // @$table / $rowlen - 1) : $_) + 1;
157                                 $_ * $rowlen .. $end * $rowlen - 1;
158                         } @select;
159                         $table = [ @$table[@cells] ];
160                 }
161                 $table;
162         }
163 } @config);
164
165 say "</div>\n";
166
167 say for $glyphs->legend;
168
169 :>
170 <script type="text/javascript" src="/clipboard.js"></script>
171