use Data::Dump 'pp';
use PLP::Functions 'EscapeHTML';
-our $VERSION = '1.00';
+our $VERSION = '1.01';
our $diinfo = do 'digraphs.inc.pl';
our %di = map { $diinfo->{$_}->[0] => $_ } grep { ref $diinfo->{$_} }
sub new {
my ($class) = @_;
- bless {}, $class;
+ bless { digraph => 1, unicode => 0 }, $class;
}
sub glyph_info {
my $title = sprintf 'U+%04X%s', $codepoint, $name && " ($name)";
my @class = ('X', grep {$_} $prop, $script);
- $cell = "<span>$cell</span>" if $prop eq 'Zs';
+ $cell = "<span>$cell</span>" if $prop and $prop eq 'Zs';
$cell = ' ' if $cell eq '';
return ($cell, EscapeHTML($title), join(' ', @class), $mnem);
@class ? sprintf(' class="%s"', join ' ', @class) : '',
$html || '',
$cell eq '' ? ' ' : $cell,
- defined $mnem && length $mnem
+ $self->{digraph} && defined $mnem && length $mnem
? sprintf(' <small class="digraph">%s</small>', EscapeHTML($mnem))
- : $cell =~ /^[^a-zA-Z]$/
+ : $self->{unicode} + $cell =~ /^[^a-zA-Z]$/ > 0
? sprintf(' <small class="%s">%04X</small>', 'value', ord $cell)
: '',
);
$colspan = 1;
}
- return sprintf qq{<table class="glyphs dilabel">\n%s</table>\n},
+ return sprintf qq{<table class="glyphs%s">\n%s</table>\n},
+ $self->{digraph} || $self->{unicode} >= 0 ? ' dilabel' : '',
join '', map {"<tr>$_\n"} @rows;
}
+sub print {
+ my $self = shift;
+ while (@_) {
+ printf '<div class="section"><h2>%s</h2>'."\n\n", shift;
+ while (ref $_[0] and $_ = shift) {
+ print $self->table($_);
+ }
+ print '</div>';
+ }
+}
+
1;
use Shiar_Sheet::FormatChar;
my $glyphs = Shiar_Sheet::FormatChar->new;
-sub print_glyph_tables {
- while (@_) {
- printf '<div class="section"><h2>%s</h2>'."\n\n", shift;
- while (ref $_[0] and $_ = shift) {
- print $glyphs->table($_);
- }
- print '</div>';
- }
+if (exists $get{q}) {
+ $glyphs->{unicode}--;
+ $glyphs->{digraph}--;
}
our $verbose = exists $get{v};
-print_glyph_tables(
+$glyphs->print(
'Popular',
[qw{. « » . ‹ › . ‘ ’ . “ ” . „ ‚ . ‟ ‛}],
[qw{. † ‡ • . § ¶ # . © ® ™ . ° ′ ″ . − × ÷ . ± ² √}],
<:
use Shiar_Sheet::FormatChar;
my $glyphs = Shiar_Sheet::FormatChar->new;
+unless (exists $get{v}) {
+ $glyphs->{unicode}--;
+ $glyphs->{digraph}--;
+}
print $glyphs->table([qw{
.>Chinese 壹 貳 參 肆 伍 陸 柒 捌 玖 零
.>Osmanya 𐒡 𐒢 𐒣 𐒤 𐒥 𐒦 𐒧 𐒨 𐒩 𐒠
}]);
-sub print_glyph_tables {
- while (@_) {
- printf '<div class="section"><h2>%s</h2>'."\n\n", shift;
- while (ref $_[0] and $_ = shift) {
- print $glyphs->table($_);
- }
- print '</div>';
- }
-}
-
-print_glyph_tables(
+$glyphs->print(
Western => [qw{
.>Latin A > B C G D > E F Y VU W Z H - I J K L M N > X O P > - Q R > S T
.>Old_Italic 𐌀 > 𐌁 > 𐌂 𐌃 > 𐌄 𐌅𐌚 > > 𐌖 𐌆 𐌇 𐌈 𐌉 𐌝 𐌊 𐌋 𐌌 𐌍 > 𐌎 𐌏 𐌐 > 𐌑 𐌒 𐌓 > 𐌔 𐌕