X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/dae21a09b01baa118720670247a87c5cdc2591b8..3e24bf25b4f498277639d4f97e64999ebfc76a11:/unicode.plp diff --git a/unicode.plp b/unicode.plp index 6457864..70f13e6 100644 --- a/unicode.plp +++ b/unicode.plp @@ -1,168 +1,89 @@ -<: -use utf8; -use strict; -use warnings; -no warnings 'qw'; # that's not a comment, it's a NUMBER SIGN -use open IO => ':utf8'; - -our $VERSION = 'v1.0'; - -$header{content_type} = 'text/html; charset=utf-8'; - -:> - +<(common.inc.plp)><: + +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'], + data => [qw'digraphs.inc.pl'], +}); - - -digraph cheat sheet -<: - my %styles = map {$_ => $_} qw(dark circus mono red terse); - our $style = exists $get{style} && $styles{$get{style}} || 'light'; - printf(qq{\n}, - $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "$_.css", $_ - ) for keys %styles; :> - +

Common Unicode

- -

Common uncommon Unicode

- -

i^k in Vim. -Also see the complete digraphs table.

+

+Glyphs are followed by +digraph or code point, +i^k or i^vu respectively in Vim. +

<: -my $diinfo = do 'digraphs.inc.pl'; -my %di = map { $diinfo->{$_}->[0] => $_ } grep { ref $diinfo->{$_} } - sort { length $a <=> length $b } keys %$diinfo; +use Shiar_Sheet::FormatChar; +my $glyphs = Shiar_Sheet::FormatChar->new; -sub quote { - local $_ = shift; - s/"/"/g; - s//>/g; - return $_; +if (exists $get{di}) { + $glyphs->{digraph} = defined $get{di} ? ! !$get{di} : 1; + $glyphs->{unicode} = 1; } - -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 '_' ? ' ' : $cell - ); - } - push @rows, sprintf '%s', 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] .= ''.($cell || ' '); - } - 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('%s%s', - defined $name ? qq{ title="$name"} : '', - @class ? sprintf(' class="%s"', join ' ', @class) : '', - $colspan > 1 && qq{ colspan="$colspan"}, - $cell eq '' ? ' ' : quote($cell), - defined $code ? sprintf(' %s', quote($code)) - : length($cell) == 1 && $cell !~ /[a-z]/ - ? sprintf(' %04X', 'value', ord $cell) - : '', - ); - - $colspan = 1; - } - - return sprintf qq{\n%s
\n}, - join '', map {"$_\n"} @rows; -} - -sub print_glyph_tables { - while (@_) { - printf "

%s

\n\n", shift; - while (ref $_[0] and $_ = shift) { - print glyph_table($_); - } - print '
'; - } +if (exists $get{q}) { + $glyphs->{unicode} = -1; + $glyphs->{digraph}--; } our $verbose = exists $get{v}; -print_glyph_tables( +$glyphs->print( '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{. ↖ ↑ ↗ ↔ . ← - → ↕ . ↙ ↓ ↘ -}], @@ -191,7 +112,9 @@ $verbose ? ( . ╵ │ ╎ ┆ ┊ ╷ ╿ . ╹ ┃ ╏ ┇ ┋ ╻ ╽ }], + [qw{. ╭ ╮ . ╰ ╯ }], [qw{. ╱ ╳ ╲ }], + # ┞┟┡┢┦┧┩┪┭┮┱┲┵┶┹┺┽┾╀╁╃╄╅╆╇╈╉╊ 'Blocks', [qw{. □ ▣ ■ . ▤ ▦ ▥ . ▧ ▩ ▨}], @@ -220,7 +143,7 @@ $verbose ? ( .>Implosive ɓ ɗ̪ > > ɗ -ᶑ ʄ ɠ ʛ = = = }], [qw{ - co . ɕ . ʑ . ɧ . ɥ . ʍ . w + - co:coarticulated .>sç ɕ .>zʝ ʑ .>ʃx ɧ .>jʷ ɥ .>hw̥ ʍ .>ɰʷ w }], [( '-', @@ -288,22 +211,13 @@ $verbose ? (
-
ascii - digraph - proposed - other unicode - discouraged + ascii + <:= $glyphs->{digraph} ? 'digraph' : 'latin1' :> + <:= $glyphs->{digraph} ? 'proposed' : 'BMP' :> + other unicode + discouraged
- + -