X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/1d37e00ff50c4cee3f23749febcfe6e33e1f608a..1fce3b7a43db2a10c3dbab2b3bc89dc7a90c3bad:/unicode.plp
diff --git a/unicode.plp b/unicode.plp
index e4e45dc..10ba7c6 100644
--- a/unicode.plp
+++ b/unicode.plp
@@ -1,160 +1,107 @@
-<:
-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 mono circus 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 uncommon Unicode
+Common 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->{$_} }
- keys %$diinfo;
+use Shiar_Sheet::FormatChar;
+my $glyphs = Shiar_Sheet::FormatChar->new;
-sub quote {
- local $_ = shift;
- s/"/"/g;
- 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 = join '', map { $di{ord $_} || '' } split //, $cell;
- my $name = $diinfo->{$code}->[1];
-
- # 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
- }
-
- if ($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(' %s%s',
- defined $name ? qq{ title="$name"} : '',
- @class ? sprintf(' class="%s"', join ' ', @class) : '',
- $colspan > 1 && qq{ colspan="$colspan"},
- $cell eq '' ? ' ' : quote($cell),
- $code ne '' ? sprintf(' %s ', quote($code))
- : length($cell) == 1 && $cell !~ /[a-z]/
- ? sprintf(' %04X ', 'value', ord $cell)
- : '',
- );
-
- $colspan = 1;
- }
-
- return sprintf qq{\n},
- join '', map {" $_\n"} @rows;
+if (exists $get{q}) {
+ $glyphs->{unicode} = -1;
+ $glyphs->{digraph}--;
}
-sub print_glyph_tables {
- while (@_) {
- printf "
%s \n\n", shift;
- while (ref $_[0] and $_ = shift) {
- print glyph_table($_);
- }
- print '';
- }
-}
+our $verbose = exists $get{v};
-print_glyph_tables(
+$glyphs->print(
'Popular',
[qw{. « » . ⹠⺠. â â . â â . â â . â â}],
[qw{. â ⡠⢠. § ¶ # . © ® ⢠. ° â² â³ . â à ÷ . ± ² â}],
- [qw{. Ã¥ ä ö ü à . Ã
æ ø ű ſ}],
- [qw{. ¿ ç ñ é ê è}],
+ [qw{. â â . â â . ⺠⹠. â â . â â }, $verbose ? () : qw{. â âº}],
+ [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{
+ . â â â â â â â â â â â â
+ }, !$verbose ? () : qw{
+ . å¯
å¯ è¾° å·³ å æª ç³ é
æ 亥 å ä¸
+ . è å
é¾ è 馬 ç¾ ç´ é ç 豬 é¼ ç
+ . ð
ð ð ð ð ð ð ð ð ð ð ð
+ }], # zodiac
+
+ 'Key commands',
+ [qw{. ⥠⤠. ⣠⫠}], # common spacing
+ [qw{. â â± â . ⦠Ⲡâ }], # edit block
+ [qw{. ⪠⯠â . ⧠⮠â }], # modifier
+ [qw{. â ⥠â â }], [qw{. âµ â â â }], # command
+$verbose ? (
+ [qw{. ⺠⩠â â¼ â« . â ⪠⮠â -ââ }], # player ui
+) : (),
'Arrows',
[qw{. â â â â . â - â â . â â â -}],
[qw{. â â â â . â - â â . â â â -}],
+ [qw{. ⬠⧠⬠⬠. ⦠- ⨠Ⳡ. ⬠⩠⬠-}],
+ [qw{. ⬠⬠⬠⬠. â¬
- ⡠⬠. ⬠⬠⬠-}],
+ [qw{. ⩠⬠⬠. ⧠⡠⨠. ⬠⬠⪠}],
[qw{. ⤠Ⲡ⥠. â â ⶠ. ⣠⼠⢠}],
[qw{. ⸠Ⳡ⹠. â â â· . ⺠⽠⿠}],
+$verbose ? (
+ [qw{. î© î§ îª . î¥ - î¦ . î« î¨ î¬ }],
+ [qw{. î± î¯ î² . î - î® . î³ î° î´ }],
+) : (),
'Line drawing',
+ [qw{. â ⦠â â . â ⬠⣠â . â â© â - }],
+ [qw{. â ⤠â . â ⪠⡠. â ⧠â }],
+ [qw{. â ⥠â . â ⫠⢠. â ⨠â }],
[qw{. â ⬠â . â ⼠⤠. â â´ â}],
[qw{. â â³ â . ⣠â â« . â â» â}],
[qw{. â ⯠â . â ⿠⥠. â â· â}],
@@ -165,23 +112,16 @@ print_glyph_tables(
. âµ â â â â â· â¿
. â¹ â â â â â» â½
}],
+ [qw{. â â® . Ⱐ⯠}],
[qw{. â± â³ â² }],
- [qw{. â ⦠â â . â ⬠⣠â . â â© â - }],
- [qw{. â ⤠â . â ⪠⡠. â ⧠â }],
- [qw{. â ⥠â . â ⫠⢠. â ⨠â }],
+ # âââ¡â¢â¦â§â©âªââ®â±â²âµâ¶â¹âºâ½â¾âââââ
âââââ
'Blocks',
- [qw{. â â â . â â â . â â â }],
+ [qw{. ⡠⣠â . ⤠⦠⥠. ⧠⩠â¨}],
[qw{. â . â . â }],
+ [qw{. â â â . â â â . â â â }],
[qw{. â â â . â â â }],
[qw{. â â â â â
â â â . â â â â â â â â }],
- [qw{. ⡠⣠â . ⤠⦠⥠. ⧠⩠â¨}],
-
- 'Signs',
- [qw{. ¤ ¢ ⥠⬠£ ⨠$ Â¥ . â« â ⦠Ⱡ⧠⮠⩠âª}],
- [qw{. â ⡠⢠⣠. ⤠⥠⦠â§}],
- [qw{. â â¿ â â â â â â
â â}], # solar
- [qw{. â â â â â â â â â â â â}], # zodiac
'IPA',
[qw{
@@ -203,7 +143,7 @@ print_glyph_tables(
.>Implosive É É̪ > > É -á¶ Ê É Ê = = =
}],
[qw{
- co . É . Ê . ɧ . É¥ . Ê . w
+ - co:coarticulated .>sç É .>zÊ Ê .>Êx ɧ .>jÊ· É¥ .>hwÌ¥ Ê .>É°Ê· w
}],
[(
'-',
@@ -219,14 +159,7 @@ print_glyph_tables(
.>Open a ɶ - - É É
}],
- 'Alphabetics',
- [qw{
- .>Latin a Ä« ı Ä Ã´ ɳ Šṡ Å¡ Ä Ã° Æ·
- .>Cyrillic а Ñ Ð¹ Ñ Ñ Ð½ Ñ Ñ Ñ Ñ Ñ Ð¯
- .>Greek α ί Ï Î· Ï Ï Ï Ï Ï Î¸ ξ Ω
- .>Hebrew × ×² × ×¢ × × × ×¡ ש × ×¦ ×¥
- }],
-
+$verbose ? (
'Japanese',
[qw{
- A I U E O _
@@ -271,26 +204,20 @@ print_glyph_tables(
.>P ã ã ã ã ã
.>V 㷠㸠㴠㹠ãº
}],
+) : (),
);
:>
- ascii
- digraph
- proposed
- other unicode
- discouraged
+ ascii
+ <:= $glyphs->{digraph} ? 'digraph' : 'latin1' :>
+ <:= $glyphs->{digraph} ? 'proposed' : 'BMP' :>
+ other unicode
+ discouraged
-
+
-