X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/66b588e944657d76b8eafab015b789f9341c9c00..9cc2512f2fbaf5ee2f423104edd65937a01d8fce:/charset.plp
diff --git a/charset.plp b/charset.plp
index f9a773a..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';
-
-:>
-
-
-
-
-charset cheat sheet
-
-
+<(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'],
+});
-
+:>
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,19 +96,9 @@ for my $cp437 (grep {$request[$_]->{set} eq 'cp437'} 0 .. $#request) {
);
}
-sub quote {
- local $_ = shift;
- s/"/"/g;
- s/</g;
- s/>/>/g;
- return $_;
-}
-
-print "\n";
-
my @nibble = (0..9, 'A'..'F');
for my $row (@request) {
- printf '', !$row->{cell} && ' charmap';
+ printf '', !$row->{cell} && ' charmap';
printf '%s', $row->{set};
print '' x 17;
for my $section (qw{thead}) {
@@ -136,33 +121,13 @@ 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";
}
- print " |
\n";
+ print "
\n";
}
-print "
\n";
-
:>
@@ -207,12 +172,3 @@ print "\n";
-
-
-