3173cfd87b3412859c3c6951572271ae54a455ec
[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                         spacing
87         Symbols
88                 symbols/currency
89                         cards
90                         ?chess
91                         signs1
92                         communic=0?communic
93                         trinity=0?trinity
94                         signs2
95         Signs
96                         solar
97                         zodiac=0?zodiac
98         Key_commands
99                 keys/spacing
100                         editing
101                         modifier
102                         control
103                         command
104                         ?player
105         Mathematics
106                 math/size
107                         equal
108                         set
109                         logic
110         Arrows
111                 arrows/single
112                         double
113                         white
114                         black
115                         block
116                         blacktri
117                         whitetri
118                         ?-large
119                         ?-heavy
120         Line_drawing
121                 lines/double
122                         doubleh
123                         doublev
124                         single
125                         heavy
126                         heavyh
127                         heavyv
128                         straight
129                         curved
130                         diagonal
131         Blocks
132                 block/square
133                         shades
134                         fill4
135                         fill4i
136                         fill8
137         IPA
138                 ipa/cons
139                         consco
140                         vowels
141         ?Japanese
142                 ?japanese/hira
143                         ?hiraderiv
144                         ?kata
145                         ?kataderiv
146 });
147
148 :></div>
149
150 <div class="legend">
151         <table class="glyphs"><tr>
152         <td class="X l4">ascii
153         <td class="X l3"><:= $glyphs->{style} eq 'di' ? 'digraph' : 'latin1' :>
154         <td class="X l2"><:= $glyphs->{style} eq 'di' ? 'proposed' : 'BMP' :>
155         <td class="X l1">other unicode
156         <td class="X ex">discouraged
157         </table>
158 </div>
159
160 <script type="text/javascript" src="/clipboard.js"></script>
161