unicode: chinese zodiac characters
[sheet.git] / unicode.plp
index 6fa204cf0e2f12a94e112d70bdbd8a53405d2862..4a3a0869c9633a5642df099d323b46bfa2060c6b 100644 (file)
@@ -22,105 +22,14 @@ Also see the <a href="/digraphs">complete digraphs table</a>.</p>
 <div class="diinfo">
 
 <:
-my $diinfo = do 'digraphs.inc.pl';
-my %di = map { $diinfo->{$_}->[0] => $_ } grep { ref $diinfo->{$_} }
-       sort { length $a <=> length $b } keys %$diinfo;
-
-sub glyph_table {
-       my ($digraphs) = @_;
-
-       my @rows;
-
-       my @colheads;
-       while ($digraphs->[0] !~ /^\./) {
-               my $cell = shift @$digraphs or last;
-               push @colheads, sprintf(
-                       '<%s%s>%s',
-                       $cell =~ s/^-// ? 'td' : 'th',
-                       $cell =~ s/:(.*)// ? qq{ title="$1"} : '',
-                       $cell eq '_' ? '&nbsp;' : $cell
-               );
-       }
-       push @rows, sprintf '<thead><tr>%s<tbody>', join '', @colheads if @colheads;
-
-       my $colspan = 1;
-       for my $cell (@$digraphs) {
-               if ($cell =~ s/^\.//) {
-                       # dot indicates start of a new row
-                       push @rows, '';
-                       if ($cell =~ s/^>//) {
-                               # header cell text follows
-                               $cell =~ s/_/ /g;  # underscores may be used instead of whitespace (for qw//ability)
-                               $rows[-1] .= '<th>'.($cell || '&nbsp;');
-                       }
-                       next;
-               }
-               elsif ($cell eq '>') {
-                       # merge this cell to the next column
-                       $colspan++;
-                       next;
-               }
-
-               my ($code, $name);
-
-               # determine display class
-               my @class;
-               if ($cell eq '-') {
-                       $cell = '';
-               }
-               elsif ($cell eq '=') {
-                       push @class, 'di-invalid';
-                       $cell = '';
-               }
-               else {
-                       push @class, 'X';
-
-                       if ($cell =~ s/^-//) {
-                               push @class, 'di-rare'; # discouraged
-                       }
-
-                       $code = join '', map { $di{ord $_} || '' } split //, $cell;
-                       $name = $diinfo->{$code}->[1];
-                       length $code == 2 or undef $code;
-
-                       if (defined $code) {
-                               push @class, 'di-d'; # digraph
-                               push @class, 'di-prop' # unofficial
-                                       if $diinfo->{$code}->[2] =~ /\bXz\b/;
-                       }
-
-                       if ($cell =~ /[ -~]/) {
-                               push @class, 'di-a'; # ascii
-                       }
-                       else {
-                               push @class, 'di-b'; # basic unicode
-                       }
-               }
-
-               # add cell html
-               $rows[-1] .= sprintf('<td%s%s%s>%s%s',
-                       defined $name  ? qq{ title="$name"}  : '',
-                       @class ? sprintf(' class="%s"', join ' ', @class) : '',
-                       $colspan > 1 && qq{ colspan="$colspan"},
-                       $cell eq '' ? '&nbsp;' : EscapeHTML($cell),
-                       defined $code ? sprintf(' <small class="digraph">%s</small>', EscapeHTML($code))
-                               : length($cell) == 1 && $cell !~ /[a-z]/
-                                       ? sprintf(' <small class="%s">%04X</small>', 'value', ord $cell)
-                                       : '',
-               );
-
-               $colspan = 1;
-       }
-
-       return sprintf qq{<table class="glyphs dilabel">\n%s</table>\n},
-               join '', map {"<tr>$_\n"} @rows;
-}
+use Shiar_Sheet::FormatChar;
+my $glyphs = Shiar_Sheet::FormatChar->new;
 
 sub print_glyph_tables {
        while (@_) {
                printf '<div class="section"><h2>%s</h2>'."\n\n", shift;
                while (ref $_[0] and $_ = shift) {
-                       print glyph_table($_);
+                       print $glyphs->table($_);
                }
                print '</div>';
        }
@@ -134,17 +43,21 @@ print_glyph_tables(
        [qw{. † ‡ • . § ¶ # . © ® ™ . ° ′ ″ . − × ÷ . ± ² √}],
        [qw{. ⚋ ⚊ . ⚐ ⚑ . ☺ ☹ . ✓ ✗ . ✔ ✘ }],
        [qw{. å ä ö ü ß . ā æ ø ű ſ}],
-       [qw{. ¿ ç ñ é ê è}],
-       [qw{. α β}], [qw{. א}],
+       [qw{. ñ ç é ê è . ŋ č ų ŭ ů }],
+       [qw{. ¿ … 〃 ‐ – . ‽ · ※ ‒ — }],
+       [qw{. α β}],
 
        'Symbols',
-       [qw{. ¤ ¢ ₥ € £ ₨ $ ¥ . ₫ ₭ ₦ ₱ ₧ ₮ ₩ ₪}],
+       [qw{. ¤ ¢ ₥ € £ ₨ $ ¥ . ฿ ₫ ₭ ₦ ₱ ₮ ₩ ₪}],
        [qw{. ♠ ♡ ♢ ♣ . ♤ ♥ ♦ ♧}],
        [qw{. ☮ ☯ ☻ ♪ ♲ ♿ }],
        [qw{. ✂ ✉ ☎ }], [qw{. ⚠ ☡ ☠}],
        'Signs',
        [qw{. ☉ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇}],  # solar
-       [qw{. ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓}],  # zodiac
+       [qw{
+               . ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓
+               . 寅 卯 辰 巳 午 未 申 酉 戌 亥 子 丑
+       }], # zodiac
 
        'Key commands',
        [qw{. ⇥ ⇤ . ␣ ⌫ }], # common spacing
@@ -211,7 +124,7 @@ $verbose ? (
                .>Implosive                 ɓ  ɗ̪  >  >  ɗ  -ᶑ ʄ  ɠ  ʛ  =  =  =
        }],
        [qw{
-               co . ɕ . ʑ . ɧ . ɥ . ʍ . w
+               - co:coarticulated .>sç ɕ .>zʝ ʑ .>ʃx ɧ .>jʷ ɥ .>hw̥ ʍ .>ɰʷ w
        }],
        [(
                '-',