From: Mischa POSLAWSKY Date: Thu, 23 Dec 2010 21:31:39 +0000 (+0100) Subject: formatchar: annotation option for html entities X-Git-Tag: v1.5~96 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/96bfc3addc80d99f3b329cbb9ed9674c6f6c89b2 formatchar: annotation option for html entities --- diff --git a/Shiar_Sheet/FormatChar.pm b/Shiar_Sheet/FormatChar.pm index 647280e..707fdc6 100644 --- a/Shiar_Sheet/FormatChar.pm +++ b/Shiar_Sheet/FormatChar.pm @@ -109,7 +109,21 @@ sub cell { my $anno = ''; for (@{ $self->{anno} }) { - if ($_ eq 'di') { + if ($_ eq 'html') { + require HTML::Entities; + if (my $_ = $HTML::Entities::char2entity{$cell}) { + $anno = sprintf(' %s', EscapeHTML($_)); + last; + } + } + elsif ($_ eq 'xml') { + require HTML::Entities; + $anno = sprintf(' %s', + sprintf "&#%d;", ord($cell) + ); + last; + } + elsif ($_ eq 'di') { if (defined $mnem and length $mnem) { $anno = sprintf(' %s', EscapeHTML($mnem)); last; diff --git a/unicode.plp b/unicode.plp index 2f9969a..0920030 100644 --- a/unicode.plp +++ b/unicode.plp @@ -36,6 +36,9 @@ if (exists $get{di}) { if (exists $get{q}) { $glyphs->{anno} = []; } +if (exists $get{html}) { + $glyphs->{anno} = ['html', 'xml']; +} our $verbose = exists $get{v};