X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/61672b1912da0a1b1669259718e04b268367f98e..84f6f39be4ffeb6307756b97126ad993bef367a8:/charset.plp diff --git a/charset.plp b/charset.plp index 73f9377..e5fdd45 100644 --- a/charset.plp +++ b/charset.plp @@ -1,30 +1,25 @@ -<: -use utf8; -use strict; -use warnings; -use open IO => ':utf8'; - -our $VERSION = 'v1.0'; - -$header{content_type} = 'text/html; charset=utf-8'; - -:> - +<(common.inc.plp)><: + +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 - - - - +:>

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) @@ -101,14 +96,6 @@ for my $cp437 (grep {$request[$_]->{set} eq 'cp437'} 0 .. $#request) { ); } -sub quote { - local $_ = shift; - s/"/"/g; - s//>/g; - return $_; -} - my @nibble = (0..9, 'A'..'F'); for my $row (@request) { printf '
', !$row->{cell} && ' charmap'; @@ -134,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 = quote($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), quote($desc), $glyph; + print "\n".$glyphs->glyph_cell($glyph); } print "\n"; } @@ -203,14 +172,3 @@ for my $row (@request) {
- - -