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