unicode: adjust default set of popular rows
[sheet.git] / unicode.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'unicode glyph cheat sheet',
5         version => 'v1.0',
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 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 5.010;
30 use Shiar_Sheet::FormatChar;
31 my $glyphs = Shiar_Sheet::FormatChar->new;
32
33 if (exists $get{di}) {
34         $glyphs->{anno} = [ (!defined $get{di} || $get{di}) && 'di', 'hex' ];
35 }
36 if (exists $get{q}) {
37         $glyphs->{anno} = [];
38 }
39 if (exists $get{html}) {
40         $glyphs->{anno} = ['html', 'xml'];
41         $glyphs->{style} = 'html';
42 }
43
44 our $verbose = exists $get{v};
45
46 my @config = qw(
47         Popular
48                 punctuation/quoting
49                         common=-5
50                 symbols/binary?symbols/binary=-5
51                 latin/sample=-1
52                         ?sample=2-
53                         ?uncommon
54                 punctuation/version
55                 punctuation/marks
56                         spacing
57         Symbols
58                 symbols/currency
59                         cards
60                         ?chess
61                         signs1
62                         communic=0?communic
63                         trinity=0?trinity
64                         signs2
65         Signs
66                         solar
67                         zodiac=0?zodiac
68         Key_commands
69                 keys/spacing
70                         editing
71                         modifier
72                         control
73                         command
74                         android
75                         ps
76                         ?player
77         Mathematics
78                 math/size
79                         equal
80                         set
81                         logic
82         Arrows
83                 arrows/single
84                         double
85                         white
86                         black
87                         block
88                         blacktri
89                         whitetri
90                         ?-large
91                         ?-heavy
92         Line_drawing
93                 lines/double
94                         doubleh
95                         doublev
96                         single
97                         heavy
98                         heavyh
99                         heavyv
100                         straight
101                         curved
102                         diagonal
103         Blocks
104                 block/square
105                         shades
106                         fill4
107                         fill4i
108                         fill8
109         IPA
110                 ipa/cons
111                         consco
112                         vowels
113         ?Japanese
114                 ?japanese/hira
115                         ?hiraderiv
116                         ?kata
117                         ?kataderiv
118 );
119
120 $_ and m{/*+(.+)} and @config = split /[ ]/, $1 for $ENV{PATH_INFO}, $get{q};
121
122 my $tables = do 'unicode-table.inc.pl' or die $@ || $!;
123
124 $glyphs->print(map {
125         my $_ = /(.*)\?(.*)/ ? ($verbose ? $2 : $1) : $_;
126         if (!$_) {
127                 ();
128         }
129         elsif (/[A-Z]/) {
130                 tr/_/ /;
131                 $_;
132         }
133         else {
134                 state $group;
135                 $group = $1 if s{^([^/]+)/}{};
136                 my @select = s/=(.*)// ? split(/=/, $1) : ();
137                 my $table = $tables->{$group}->{$_}
138                         or die "Unknown table specified: $group/$_";
139
140                 if (@select) {
141                         my $rowlen;
142                         for ($rowlen = 1; $rowlen++; $rowlen <= $#$table) {
143                                 last if $table->[$rowlen] =~ /\./;
144                         }
145                         my @cells = map {
146                                 my $end = (s/-(.+)?// ? ($1 // @$table / $rowlen - 1) : $_) + 1;
147                                 $_ * $rowlen .. $end * $rowlen - 1;
148                         } @select;
149                         $table = [ @$table[@cells] ];
150                 }
151                 $table;
152         }
153 } @config);
154
155 :></div>
156
157 <div class="legend">
158         <table class="glyphs"><tr>
159         <td class="X l4">ascii
160         <td class="X l3"><:= $glyphs->{style} eq 'di' ? 'digraph' : 'latin1' :>
161         <td class="X l2"><:= $glyphs->{style} eq 'di' ? 'proposed' : 'BMP' :>
162         <td class="X l1">other unicode
163         <td class="X ex">discouraged
164         </table>
165 </div>
166
167 <script type="text/javascript" src="/clipboard.js"></script>
168