unicode: fix for non-digraph digraphs
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 2 May 2009 15:53:56 +0000 (15:53 +0000)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 2 May 2009 15:53:56 +0000 (15:53 +0000)
unicode.plp

index e4e45dc..bcfebd1 100644 (file)
@@ -81,8 +81,7 @@ sub glyph_table {
                        next;
                }
 
-               my $code = join '', map { $di{ord $_} || '' } split //, $cell;
-               my $name = $diinfo->{$code}->[1];
+               my ($code, $name);
 
                # determine display class
                my @class;
@@ -98,11 +97,18 @@ sub glyph_table {
                                push @class, 'di-rare'; # discouraged
                        }
 
-                       if ($code) {
+                       $code = join '', map { $di{ord $_} || '' } split //, $cell;
+                       $name = $diinfo->{$code}->[1];
+                       length $code == 2 or undef $code;
+
+                       if (defined $code) {
                                push @class, 'di-d'; # digraph
                                push @class, 'di-prop' # unofficial
                                        if $diinfo->{$code}->[2] =~ /\bXz\b/;
                        }
+                       elsif (defined $name) {
+                               push @class, 'X';
+                       }
 
                        if ($cell =~ /[ -~]/) {
                                push @class, 'di-a'; # ascii
@@ -118,7 +124,7 @@ sub glyph_table {
                        @class ? sprintf(' class="%s"', join ' ', @class) : '',
                        $colspan > 1 && qq{ colspan="$colspan"},
                        $cell eq '' ? '&nbsp;' : quote($cell),
-                       $code ne '' ? sprintf(' <small class="digraph">%s</small>', quote($code))
+                       defined $code ? sprintf(' <small class="digraph">%s</small>', quote($code))
                                : length($cell) == 1 && $cell !~ /[a-z]/
                                        ? sprintf(' <small class="%s">%04X</small>', 'value', ord $cell)
                                        : '',