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