charset: no .X on empty glyph cells
[sheet.git] / Shiar_Sheet / FormatChar.pm
index 80546556aae9f5153d73166c8e95b07ad33c8863..ef0445d01d968f127be31ebc2f821affb0fed564 100644 (file)
@@ -8,7 +8,7 @@ use utf8;
 use Data::Dump 'pp';
 use PLP::Functions 'EscapeHTML';
 
-our $VERSION = '1.06';
+our $VERSION = '1.07';
 
 our $uc = do 'unicode-char.inc.pl';
 
@@ -34,12 +34,12 @@ sub glyph_html {
        my ($class, $name, $mnem, $entity, $string) = @$info;
 
        my $cell = EscapeHTML($string || $char);
-       my $title = sprintf 'U+%04X%s', $codepoint, $name && " ($name)";
+       my $title = sprintf 'U+%04X%s', $codepoint, !!$name && " ($name)";
 
-       $cell = "<span>$cell</span>" if $class =~ /\bZs\b/;
+       $cell = "<span>$cell</span>" if $class and $class =~ /\bZs\b/;
        $cell = '&nbsp;' if $cell eq '';
 
-       return ($cell, EscapeHTML($title), "X $class", $mnem, $entity);
+       return ($cell, EscapeHTML($title), !!$class && "X $class", $mnem, $entity);
 }
 
 sub glyphs_html {
@@ -109,7 +109,7 @@ sub cell {
                }
 
                if ($self->{style} eq 'di') {
-                       if ($mnem =~ /…/) {
+                       if ($mnem and $mnem =~ /…/) {
                                # incomplete representation, usually partial
                        }
                        elsif ($class =~ /\bu-di\b/) {