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 647280e8b878bca433512dad57c2e9d062bd44df..707fdc65298eadcc142579a05cde1a3a8bba5689 100644 (file)
@@ -109,7 +109,21 @@ sub cell {
 
        my $anno = '';
        for (@{ $self->{anno} }) {
 
        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;
                        if (defined $mnem and length $mnem) {
                                $anno = sprintf(' <small class="digraph">%s</small>', EscapeHTML($mnem));
                                last;
index 2f9969a3e70dce904b9693e960e70d8f7316b969..09200305cf17c37c932554e2aab772045eb2c755 100644 (file)
@@ -36,6 +36,9 @@ if (exists $get{di}) {
 if (exists $get{q}) {
        $glyphs->{anno} = [];
 }
 if (exists $get{q}) {
        $glyphs->{anno} = [];
 }
+if (exists $get{html}) {
+       $glyphs->{anno} = ['html', 'xml'];
+}
 
 our $verbose = exists $get{v};
 
 
 our $verbose = exists $get{v};