X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/96bfc3addc80d99f3b329cbb9ed9674c6f6c89b2..6c08f60465c441baff92074c3122fcb62457658c:/Shiar_Sheet/FormatChar.pm diff --git a/Shiar_Sheet/FormatChar.pm b/Shiar_Sheet/FormatChar.pm index 707fdc6..62f6791 100644 --- a/Shiar_Sheet/FormatChar.pm +++ b/Shiar_Sheet/FormatChar.pm @@ -109,17 +109,23 @@ sub cell { my $anno = ''; for (@{ $self->{anno} }) { - if ($_ eq 'html') { + if (/html$/) { require HTML::Entities; - if (my $_ = $HTML::Entities::char2entity{$cell}) { - $anno = sprintf(' %s', EscapeHTML($_)); + if (my $entity = $HTML::Entities::char2entity{$cell}) { + $entity = substr($entity, 1, -1) unless /^&/; + $anno = sprintf(' %s', EscapeHTML($entity)); last; } } elsif ($_ eq 'xml') { - require HTML::Entities; $anno = sprintf(' %s', - sprintf "&#%d;", ord($cell) + sprintf '#%d', ord($cell) + ); + last; + } + elsif ($_ eq '&xml') { + $anno = sprintf(' %s', + sprintf '&#%d;', ord($cell) ); last; }