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