unicode: reorder popular tables
[sheet.git] / unicode.plp
index 1c2d37d7e26f66fbb74264ecf9131aea17663a19..fb5ee03672068556ab492ffac406f10bb490c8fd 100644 (file)
 <(common.inc.plp)><:
-       our $VERSION = 'v1.0';
 
-:><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en">
-
-<head>
-<meta http-equiv="content-type" content="utf-8">
-<title>digraph cheat sheet</title>
-<meta name="description" content="Common Unicode characters with digraph or code point, layed out for quick location. Includes general signs, arrows, drawing characters, and IPA letters.">
-<meta name="keywords" content="unicode, glyph, char, character, reference, common, ipa, sign, mark, table, digraph">
-<:= stylesheet(qw'light dark red') :>
-<link rel="icon" type="image/png" href="/clip.png">
-</head>
-
-<body id="unicode">
-<h1>Common uncommon Unicode</h1>
-
-<p>i^k in <a href="/">Vim</a>.
-Also see the <a href="/digraphs">complete digraphs table</a>.</p>
+Html({
+       title => 'unicode glyph cheat sheet',
+       version => 'v1.0',
+       description => [
+               "Common Unicode characters with digraph or code point, layed out for quick location.",
+               "Includes general symbols, arrows, drawing characters, and IPA letters.",
+       ],
+       keywords => [qw'
+               unicode glyph char character reference common ipa symbol sign mark table digraph
+       '],
+       stylesheet => [qw'light dark red'],
+});
+
+:>
+<h1>Common Unicode</h1>
+
+<p>
+Glyphs are followed by
+<a href="/digraphs">digraph</a> or <a href="/charset">code point</a>,
+i^k or i^vu respectively in <a href="/vi">Vim</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 {
-                       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/;
-                       }
-                       elsif (defined $name) {
-                               push @class, 'X';
-                       }
-
-                       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,16 +44,46 @@ print_glyph_tables(
        'Popular',
        [qw{. « » . ‹ › . ‘ ’ . “ ” . „ ‚ . ‟ ‛}],
        [qw{. † ‡ • . § ¶ # . © ® ™ . ° ′ ″ . − × ÷ . ± ² √}],
-       [qw{. ⚋ ⚊ . ⚐ ⚑ . ☺ ☹ . ✓ ✗ . ✔ ✘ . ◄ ► }],
+       [qw{. ⚋ ⚊ . ⚐ ⚑ . ☺ ☹ . ✓ ✗ . ✔ ✘ }, $verbose ? () : qw{. ◄ ►}],
        [qw{. å ä ö ü ß . ā æ ø ű ſ}],
-       [qw{. ¿ ç ñ é ê è}],
-       [qw{. α β}], [qw{. א}],
-
-       'Signs',
-       [qw{. ¤ ¢ ₥ € £ ₨ $ ¥ . ₫ ₭ ₦ ₱ ₧ ₮ ₩ ₪}],
+       [qw{
+               . á è õ û ç . ą ı ơ ů þ
+       }],
+       $verbose ? [qw{
+               .>Englisc   æ ð ē ȝ œ þ ƿ
+               .>Sámi      á č đ ŋ š ŧ ž
+               .>Slavic    ą ě ł ů ź ż ž
+               .>Türkçe    ç ğ ı İ ö ş ü
+               .>Esperanto ĉ ĝ ĥ ĵ ŝ ŭ
+       }] : (),
+       [qw{. α β}],
+       [qw{. ¿ … 〃 ‐ – . ‽ · ※ ‒ — }],
+
+       'Symbols',
+       [qw{. ¤ ¢ ₥ € £ ₨ $ ¥ . ฿ ₫ ₭ ₦ ₱ ₮ ₩ ₪}],
        [qw{. ♠ ♡ ♢ ♣ . ♤ ♥ ♦ ♧}],
+       [qw{. ☮ ☯ ☻ ♪ ♲ ♿ }],
+       [qw{. ✂ ✉ ℻ ☎ ☏}, $verbose ? qw{. 🔞 🔾 🔰 🔮 🕀 } : ()], # communication
+       [qw{. ✊ ✋ ✌ }, $verbose ? qw{. 🖹 🐜 👼 } : ()], # 3-way (RockPaperScissors, TerranProtossZerg)
+       [qw{. ⚠ ☡ ☠}],
+       'Signs',
        [qw{. ☉ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇}],  # solar
-       [qw{. ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓}],  # zodiac
+       [qw{
+               . ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓
+       }, !$verbose ? () : qw{
+               . 寅 卯 辰 巳 午 未 申 酉 戌 亥 子 丑
+               . 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬 鼠 牛
+               . 🐅 🐇 🐉 🐍 🐎 🐐 🐒 🐓 🐕 🐖 🐀 🐂
+       }], # zodiac
+
+       'Key commands',
+       [qw{. ⇥ ⇤ . ␣ ⌫ }], # common spacing
+       [qw{. ⎀ ⇱ ⇞ . ⌦ ⇲ ⇟ }], # edit block
+       [qw{. ⇪ ⇯ ⇭ . ⇧ ⇮ № }], # modifier
+       [qw{. ⎈ ⌥ ⌘ ⎄ }], [qw{. ↵ ⎋ ⎉ ⎊ }], # command
+$verbose ? (
+       [qw{. ► ⏩ ⏭ ◼ ⚫ . ◄ ⏪ ⏮ ⏏ -❚❚ }], # player ui
+) : (),
 
        'Arrows',
        [qw{. ↖ ↑ ↗ ↔ . ← - → ↕ . ↙ ↓ ↘ -}],
@@ -172,7 +112,9 @@ $verbose ? (
                . ╵ │ ╎ ┆ ┊ ╷ ╿
                . ╹ ┃ ╏ ┇ ┋ ╻ ╽
        }],
+       [qw{. ╭ ╮ . ╰ ╯ }],
        [qw{. ╱ ╳ ╲ }],
+       # ┞┟┡┢┦┧┩┪┭┮┱┲┵┶┹┺┽┾╀╁╃╄╅╆╇╈╉╊
 
        'Blocks',
        [qw{. □ ▣ ■ . ▤ ▦ ▥ . ▧ ▩ ▨}],
@@ -201,7 +143,7 @@ $verbose ? (
                .>Implosive                 ɓ  ɗ̪  >  >  ɗ  -ᶑ ʄ  ɠ  ʛ  =  =  =
        }],
        [qw{
-               co . ɕ . ʑ . ɧ . ɥ . ʍ . w
+               - co:coarticulated .>sç ɕ .>zʝ ʑ .>ʃx ɧ .>jʷ ɥ .>hw̥ ʍ .>ɰʷ w
        }],
        [(
                '-',
@@ -277,14 +219,3 @@ $verbose ? (
        </table>
 </div>
 
-<p class="footer">
-       <a href="/" rel="home">sheet.shiar.nl</a>/unicode.<a href="/source/unicode.plp"
-        rel="code" title="Written in Perl">plp</a>
-       <a href="http://git.shiar.nl/sheet.git/history/HEAD:/unicode.plp"
-        rel="vcs-git" title="Git repository"><:= $VERSION :></a>
-       created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
-       <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
-        title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
-</p>
-
-</html>