- my ($code, $name);
-
- # determine display class
- my @class;
- if ($cell eq '-') {
- $cell = '';
- }
- elsif ($cell eq '=') {
- push @class, 'di-invalid';
- $cell = '';
- }
- else {
- if ($cell =~ s/^-//) {
- push @class, 'di-rare'; # discouraged
- }
-
- $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
- }
- else {
- push @class, 'di-b'; # basic unicode
- }
- }
-
- # add cell html
- $rows[-1] .= sprintf('<td%s%s%s>%s%s',
- defined $name ? qq{ title="$name"} : '',
- @class ? sprintf(' class="%s"', join ' ', @class) : '',
- $colspan > 1 && qq{ colspan="$colspan"},
- $cell eq '' ? ' ' : EscapeHTML($cell),
- defined $code ? sprintf(' <small class="digraph">%s</small>', EscapeHTML($code))
- : length($cell) == 1 && $cell !~ /[a-z]/
- ? sprintf(' <small class="%s">%04X</small>', 'value', ord $cell)
- : '',
- );
-
- $colspan = 1;
- }
-
- return sprintf qq{<table class="glyphs dilabel">\n%s</table>\n},
- join '', map {"<tr>$_\n"} @rows;