charset: compare classes legend
[sheet.git] / charset.plp
index 5668225b2512169914da35586d3592992119f63c..79ebd96deb2ff338c4bdf494ca7425fa94e785a1 100644 (file)
@@ -139,7 +139,9 @@ sub tabinput {
 
                if (my ($parent, $part) = pairfirst { defined $visible->{$a} } @parents) {
                        $row{parent} = $parent;
-                       $params = $visible->{$parent} ? $part : 128;
+                       $params = $part;
+                       $params = 128 unless $visible->{$parent}
+                               or ($input eq 'MacCroatian' and defined $visible->{MacRomanian});
                }
                elsif (defined $visible->{ascii}) {
                        $row{parent} = $parents[0];
@@ -321,6 +323,20 @@ for my $row (@request) {
                                next;
                        }
 
+                       if (exists $get{compare}) {
+                               state $visible = {};
+                               my $cp = $offset + $row->{offset};
+                               printf '<td class="%s" title="%3$s">%2$s',
+                                       $cp == ord $glyph ? 'l4' :
+                                       $row->{parent} && $glyph eq
+                                               Encode::decode($row->{parent}, pack 'C', $cp) ? 'l3' :
+                                       $visible->{$glyph} ? 'l2' :
+                                       'l1',
+                                       $glyphs->glyph_html($glyph);
+                               $visible->{$glyph}++;
+                               next;
+                       }
+
                        print "\n".$glyphs->glyph_cell($glyph);
                }
                continue {
@@ -335,7 +351,13 @@ for my $row (@request) {
 <hr>
 
 <div class="legend">
-       <table class="glyphs"><tr>
+       <table class="glyphs"><tr><: if (exists $get{compare}) { :>
+       <td class="X l4">unicode
+       <td class="X l3">inherited
+       <td class="X l2">existing
+       <td class="X l1">original
+       <td class="">unassigned
+<: } else { :>
        <td class="X Cc">control
        <td class="X Zs"><span>whitespace</span>
        <td class="X Mn">diacritic<table class="glyphs"><tr>
@@ -372,6 +394,6 @@ for my $row (@request) {
        <td class="X Xd">deprecated
        <td class="">unassigned
        <td class="X Xi">invalid
-       </table>
+<: } :>        </table>
 </div>