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