From: Mischa POSLAWSKY Date: Thu, 23 Dec 2010 21:41:30 +0000 (+0100) Subject: formatchar: avoid annotation of empty cells (regression) X-Git-Tag: v1.5~94 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/0e8416907674da88819b70d6db208fa490d0f946 formatchar: avoid annotation of empty cells (regression) --- diff --git a/Shiar_Sheet/FormatChar.pm b/Shiar_Sheet/FormatChar.pm index 62f6791..78f2a19 100644 --- a/Shiar_Sheet/FormatChar.pm +++ b/Shiar_Sheet/FormatChar.pm @@ -108,38 +108,40 @@ sub cell { } my $anno = ''; - for (@{ $self->{anno} }) { - if (/html$/) { - require HTML::Entities; - if (my $entity = $HTML::Entities::char2entity{$cell}) { - $entity = substr($entity, 1, -1) unless /^&/; - $anno = sprintf(' %s', EscapeHTML($entity)); - last; + if ($cell ne '') { + for (@{ $self->{anno} }) { + if (/html$/) { + require HTML::Entities; + if (my $entity = $HTML::Entities::char2entity{$cell}) { + $entity = substr($entity, 1, -1) unless /^&/; + $anno = sprintf(' %s', EscapeHTML($entity)); + last; + } } - } - elsif ($_ eq 'xml') { - $anno = sprintf(' %s', - sprintf '#%d', ord($cell) - ); - last; - } - elsif ($_ eq '&xml') { - $anno = sprintf(' %s', - sprintf '&#%d;', ord($cell) - ); - last; - } - elsif ($_ eq 'di') { - if (defined $mnem and length $mnem) { - $anno = sprintf(' %s', EscapeHTML($mnem)); + elsif ($_ eq 'xml') { + $anno = sprintf(' %s', + sprintf '#%d', ord($cell) + ); last; } - } - else { - if ($_ eq 'hex' or $cell =~ /^[^a-zA-Z]$/) { - $anno = sprintf(' %04X', 'value', ord $cell); + elsif ($_ eq '&xml') { + $anno = sprintf(' %s', + sprintf '&#%d;', ord($cell) + ); last; } + elsif ($_ eq 'di') { + if (defined $mnem and length $mnem) { + $anno = sprintf(' %s', EscapeHTML($mnem)); + last; + } + } + else { + if ($_ eq 'hex' or $cell =~ /^[^a-zA-Z]$/) { + $anno = sprintf(' %04X', 'value', ord $cell); + last; + } + } } }