formatchar: annotation option for html entities
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 23 Dec 2010 21:31:39 +0000 (22:31 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 11 Jan 2011 22:41:38 +0000 (23:41 +0100)
Shiar_Sheet/FormatChar.pm
unicode.plp

index 647280e..707fdc6 100644 (file)
@@ -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(' <small class="digraph">%s</small>', EscapeHTML($_));
+                               last;
+                       }
+               }
+               elsif ($_ eq 'xml') {
+                       require HTML::Entities;
+                       $anno = sprintf(' <small class="digraph">%s</small>',
+                               sprintf "&amp;#%d;", ord($cell)
+                       );
+                       last;
+               }
+               elsif ($_ eq 'di') {
                        if (defined $mnem and length $mnem) {
                                $anno = sprintf(' <small class="digraph">%s</small>', EscapeHTML($mnem));
                                last;
index 2f9969a..0920030 100644 (file)
@@ -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};