X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/28151a28db84c6d6018232f36c0003ecd562b3f0..054d1037c3f618df44d195a3e63b4832d0eab3b7:/charset.plp?ds=sidebyside
diff --git a/charset.plp b/charset.plp
index 29e7e23..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)
@@ -94,14 +96,6 @@ for my $cp437 (grep {$request[$_]->{set} eq 'cp437'} 0 .. $#request) {
);
}
-sub quote {
- local $_ = shift;
- s/"/"/g;
- s/</g;
- s/>/>/g;
- return $_;
-}
-
my @nibble = (0..9, 'A'..'F');
for my $row (@request) {
printf '', !$row->{cell} && ' charmap';
@@ -127,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";
}
@@ -196,14 +172,3 @@ for my $row (@request) {
|
-
-
-