X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/c11640facf0c976140547ef1b58971ec8a661dd3..ca8caa9227ad9151bd57ab7eccab2c8947ea55da:/charset.plp diff --git a/charset.plp b/charset.plp index 66e0cc9..e5fdd45 100644 --- a/charset.plp +++ b/charset.plp @@ -1,23 +1,25 @@ <(common.inc.plp)><: - our $VERSION = 'v1.0'; -:> - +Html({ + title => 'charset cheat sheet', + version => 'v1.0', + description => [ + "Reference sheet with all glyphs in common character encoding tables,", + "and an overview of Unicode ranges and UTF-8 bytes.", + ], + keywords => [qw' + charset codepage unicode ascii utf8 latin glyph character encoding + reference common overview table + '], + stylesheet => [qw'light'], +}); - - -charset cheat sheet -<:= stylesheet(qw'light') :> - - - +:>

Character encoding

<: -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; use Encode qw(decode resolve_alias); # generate character table(s) @@ -119,25 +121,7 @@ for my $row (@request) { next; } - my $info = [ord $glyph]; - if (defined (my $mnem = $di{ord $glyph})) { - $info = $diinfo->{$mnem}; - } - else { - require Unicode::UCD; - my $fullinfo = Unicode::UCD::charinfo(ord $glyph); - $info = [@$fullinfo{qw/code name category script string/}] if $fullinfo; - } - my ($codepoint, $name, $prop, $script, $string) = @$info; - - $glyph = EscapeHTML($string || $glyph); - my $desc = sprintf 'U+%04X%s', $codepoint, $name && " ($name)"; - my @class = ('X', grep {$_} $prop, $script); - - $glyph = "$glyph" if $prop eq 'Zs'; - - printf "\n".'%s', - join(' ', @class), EscapeHTML($desc), $glyph; + print "\n".$glyphs->glyph_cell($glyph); } print "\n"; } @@ -188,14 +172,3 @@ for my $row (@request) { - - -