mutt: page, key classes, various updates
[sheet.git] / unicode.plp
index 4d935549f01c70bb853d65f46d7e9ea64f2ac0cb..b55e7715fa2e838d065b60fc01f4eacac77e6e4e 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 no  warnings 'qw';  # that's not a comment, it's a NUMBER SIGN
 use open IO => ':utf8';
 
-our $VERSION = '1.0';
+our $VERSION = 'v1.0';
 
 $header{content_type} = 'text/html; charset=utf-8';
 
@@ -14,12 +14,18 @@ $header{content_type} = 'text/html; charset=utf-8';
 <html>
 
 <head>
-<title>digraph cheat sheet</title>
 <meta http-equiv="content-type" content="utf-8">
-<link rel="stylesheet" type="text/css" media="all" href="/digraphs.css">
+<title>digraph cheat sheet</title>
+<link rel="stylesheet" type="text/css" media="all" href="/base.css"><:
+       my %styles = map {$_ => $_} qw(dark circus mono red terse);
+       our $style = exists $get{style} && $styles{$get{style}} || 'light';
+       printf(qq{\n<link rel="%s" type="text/css" media="all" href="%s" title="%s">},
+               $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "$_.css", $_
+       ) for keys %styles;
+:>
 </head>
 
-<body>
+<body id="unicode">
 <h1>Common uncommon Unicode</h1>
 
 <p>i^k in <a href="/">Vim</a>.
@@ -30,7 +36,7 @@ Also see the <a href="/digraphs">complete digraphs table</a>.</p>
 <:
 my $diinfo = do 'digraphs.inc.pl';
 my %di = map { $diinfo->{$_}->[0] => $_ } grep { ref $diinfo->{$_} }
-       keys %$diinfo;
+       sort { length $a <=> length $b } keys %$diinfo;
 
 sub quote {
        local $_ = shift;
@@ -75,8 +81,7 @@ sub glyph_table {
                        next;
                }
 
-               my $code = join '', map { $di{ord $_} || '' } split //, $cell;
-               my $name = $diinfo->{$code}->[1];
+               my ($code, $name);
 
                # determine display class
                my @class;
@@ -92,11 +97,18 @@ sub glyph_table {
                                push @class, 'di-rare'; # discouraged
                        }
 
-                       if ($code) {
+                       $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
@@ -112,7 +124,7 @@ sub glyph_table {
                        @class ? sprintf(' class="%s"', join ' ', @class) : '',
                        $colspan > 1 && qq{ colspan="$colspan"},
                        $cell eq '' ? '&nbsp;' : quote($cell),
-                       $code ne '' ? sprintf(' <small class="digraph">%s</small>', quote($code))
+                       defined $code ? sprintf(' <small class="digraph">%s</small>', quote($code))
                                : length($cell) == 1 && $cell !~ /[a-z]/
                                        ? sprintf(' <small class="%s">%04X</small>', 'value', ord $cell)
                                        : '',
@@ -135,20 +147,40 @@ sub print_glyph_tables {
        }
 }
 
+our $verbose = exists $get{v};
+
 print_glyph_tables(
        'Popular',
-       [qw{. « » . ‹ › . ‘ ’ . “ ” . „ ‚}],
-       [qw{. † ‡ • . § ¶ # . © ® ™ . − × ÷ . ± ² √}],
+       [qw{. « » . ‹ › . ‘ ’ . “ ” . „ ‚ . ‟ ‛}],
+       [qw{. † ‡ • . § ¶ # . © ® ™ . ° ′ ″ . − × ÷ . ± ² √}],
+       [qw{. ⚋ ⚊ . ⚐ ⚑ . ☺ ☹ . ✓ ✗ . ✔ ✘ . ◄ ► }],
        [qw{. å ä ö ü ß . Å æ ø ű ſ}],
        [qw{. ¿ ç ñ é ê è}],
+       [qw{. α β}], [qw{. א}],
+
+       'Signs',
+       [qw{. ¤ ¢ ₥ € £ ₨ $ ¥ . ₫ ₭ ₦ ₱ ₧ ₮ ₩ ₪}],
+       [qw{. ♠ ♡ ♢ ♣ . ♤ ♥ ♦ ♧}],
+       [qw{. ☉ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇}],  # solar
+       [qw{. ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓}],  # zodiac
 
        'Arrows',
        [qw{. ↖ ↑ ↗ ↔ . ← - → ↕ . ↙ ↓ ↘ -}],
        [qw{. ⇖ ⇑ ⇗ ⇔ . ⇐ - ⇒ ⇕ . ⇙ ⇓ ⇘ -}],
-       [qw{. ◤ ▲ ◥ . ◀ ◆ ▶ . ◣ ▼ ◢}],
-       [qw{. ◸ △ ◹ . ◁ ◇ ▷ . ◺ ▽ ◿}],
+       [qw{. ⬁ ⇧ ⬀ ⬄ . ⇦ - ⇨ ⇳ . ⬃ ⇩ ⬂ -}],
+       [qw{. ⬉ ⬆ ⬈ ⬌ . ⬅ - ➡ ⬍ . ⬋ ⬇ ⬊ -}],
+       [qw{. ◩ ⬒ ⬔   . ◧ □ ◨   . ⬕ ⬓ ◪  }],
+       [qw{. ◤ ▲ ◥   . ◀ ◆ ▶   . ◣ ▼ ◢  }],
+       [qw{. ◸ △ ◹   . ◁ ◇ ▷   . ◺ ▽ ◿  }],
+$verbose ? (
+       [qw{.    .  -  .    }],
+       [qw{.    .  -  .    }],
+) : (),
 
        'Line drawing',
+       [qw{. ╔ ╦ ╗ ═ . ╠ ╬ ╣ ║ . ╚ ╩ ╝ - }],
+       [qw{. ╒ ╤ ╕ . ╞ ╪ ╡ . ╘ ╧ ╛ }],
+       [qw{. ╓ ╥ ╖ . ╟ ╫ ╢ . ╙ ╨ ╜ }],
        [qw{. ┌ ┬ ┐ . ├ ┼ ┤ . └ ┴ ┘}],
        [qw{. ┏ ┳ ┓ . ┣ ╋ ┫ . ┗ ┻ ┛}],
        [qw{. ┍ ┯ ┑ . ┝ ┿ ┥ . ┕ ┷ ┙}],
@@ -160,22 +192,13 @@ print_glyph_tables(
                . ╹ ┃ ╏ ┇ ┋ ╻ ╽
        }],
        [qw{. ╱ ╳ ╲ }],
-       [qw{. ╔ ╦ ╗ ═ . ╠ ╬ ╣ ║ . ╚ ╩ ╝ - }],
-       [qw{. ╒ ╤ ╕ . ╞ ╪ ╡ . ╘ ╧ ╛ }],
-       [qw{. ╓ ╥ ╖ . ╟ ╫ ╢ . ╙ ╨ ╜ }],
 
        'Blocks',
-       [qw{. �� ▀ ▝ . ▌ █ ▐ . ▖ ▄ ▗ }],
+       [qw{. �� ▣ ■ . ▤ ▦ ▥ . ▧ ▩ ▨}],
        [qw{. ░ . ▒ . ▓ }],
+       [qw{. ▘ ▀ ▝ . ▌ █ ▐ . ▖ ▄ ▗ }],
        [qw{. ▛ ▚ ▟ . ▙ ▞ ▜ }],
        [qw{. ▁ ▂ ▃ ▄ ▅ ▆ ▇ ▔ . ▏ ▎ ▍ ▌ ▋ ▊ ▉ ▕ }],
-       [qw{. □ ▣ ■ . ▤ ▦ ▥ . ▧ ▩ ▨}],
-
-       'Signs',
-       [qw{. ¤ ¢ ₥ € £ ₨ $ ¥ . ₫ ₭ ₦ ₱ ₧ ₮ ₩ ₪}],
-       [qw{. ♠ ♡ ♢ ♣ . ♤ ♥ ♦ ♧}],
-       [qw{. ☉ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇}],  # solar
-       [qw{. ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓}],  # zodiac
 
        'IPA',
        [qw{
@@ -213,14 +236,7 @@ print_glyph_tables(
                .>Open       a ɶ  - -  ɑ ɒ
        }],
 
-       'Alphabetics',
-       [qw{
-               .>Latin    a ī ı ę ô ɳ ŋ ṡ š đ ð Ʒ
-               .>Cyrillic а і й э ё н њ ш щ ч ь Я
-               .>Greek    α ί ϊ η ϋ π ψ σ ς θ ξ Ω
-               .>Hebrew   א ײ י ע ו נ ן ס ש ט צ ץ
-       }],
-
+$verbose ? (
        'Japanese',
        [qw{
                  - A  I  U  E  O  _
@@ -233,7 +249,7 @@ print_glyph_tables(
                .>M ま み む め も =
                .>Y や =  ゆ =  よ =
                .>R ら り る れ ろ =
-               .>W わ ゐ =  ゑ を =
+               .>W わ -ゐ = -ゑ を =
        }],
        [qw{
                  - A  I  U  E  O
@@ -265,20 +281,27 @@ print_glyph_tables(
                .>P パ ピ プ ペ ポ
                .>V ヷ ヸ ヴ ヹ ヺ
        }],
+) : (),
 );
 
 :></div>
 
-<p id="footer">
-       <a href="http://vi.shiar.net/unicode">vi.<strong>shiar.net</strong>/unicode</a>
-       <a href="git://dev.shiar.net/vi-cheat"><:= "v$VERSION" :></a>
-       created by Shiar •
-       <a title="Licensed under the GNU Affero General Public License, version 3"
-          href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a> •
-       last update <:
-               use Time::Format qw(time_format);
-               print time_format('yyyy-mm-dd', (stat $ENV{SCRIPT_FILENAME})[9]);
-       :>
+<div class="legend">
+       <table class="glyphs"><tr>
+       <td class="X di-a">ascii
+       <td class="X di-d">digraph
+       <td class="X di-prop">proposed
+       <td class="X di-b">other unicode
+       <td class="X di-rare">discouraged
+       </table>
+</div>
+
+<p class="footer">
+       <a href="/" rel="home">sheet.shiar.nl</a>/unicode
+       <a href="git://git.shiar.nl/sheet" rel="vcs-git" title="Git repository"><:= $VERSION :></a>
+       created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
+       <a title="Licensed under the GNU Affero General Public License, version 3" rel="copyright"
+          href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a>
 </p>
 
 </html>