unicode: set multiple property classes
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 11 Oct 2008 11:41:46 +0000 (11:41 +0000)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 6 Jan 2009 22:39:02 +0000 (22:39 +0000)
If several non-exclusive character attributes are present, set all relevant
style classes (and try to show the most relevant).

digraphs.css
unicode.plp

index 5593697a166ee8eb1e11406410691c074e26ec53..6d858e6070046b41cb2dbfcd4a138e356b67be10 100644 (file)
@@ -151,7 +151,7 @@ table.glyphs.dimap {
        background: #CCC;
        color: #666;
 
-       background: #800;
+       background: #600;
        color: #FFF;
        opacity: 0.3;
 }
@@ -192,13 +192,15 @@ td.Zs span                 {background: #EEE}
 td.Co                      {background: #A99} /* private */
 
 /* implementation-based alternatives */
-td.Ascii    {background: #EFD} /* ascii */
-td.Di       {background: #FFD} /* rfc-1345 digraph */
-td.DiProp   {background: #FED} /* proposed digraph */
-td.DiNone   {background: #FDD} /* other unicode */
-td.Reserved {background: #BBB} /* impossible */
+td.di-b       {background: #FDD} /* bmp */
+td.di-d       {background: #FFD} /* rfc-1345 digraph */
+td.di-prop    {background: #FED} /* proposed digraph */
+td.di-a       {background: #EFD} /* ascii */
+td.di-rare    {background: #EEE} /* disfavoured */
+td.di-invalid {background: #BBB} /* impossible */
 
 /* hover effects */
+td.di-d,
 td.X:hover {cursor: help}
 td.Greek:hover                                     {background: #FA9}
 td.Cyrillic:hover                                  {background: #FB7}
@@ -223,4 +225,8 @@ td.Co:hover                                        {background: #A77} /* private
 td.Xa:hover {outline: 1px solid #0F0} /* ascii */
 td.Xl:hover {outline: 1px solid #0C0} /* latin1 */
 td.Xz:hover {outline: 1px solid #F00} /* proposed */
+td.di-b:hover                                      {background: #F88}
+td.di-d:hover                                      {background: #FF8}
+td.di-prop:hover                                   {background: #FC8}
+td.di-a:hover                                      {background: #CF8}
 
index 8dfe1322ba87b1aeab5cf6bf457908b1c2af7e6a..5e0327e6c494d60379d4aa6494d30560b0268b72 100644 (file)
@@ -59,7 +59,6 @@ sub glyph_table {
 
        my $colspan = 1;
        for my $cell (@$digraphs) {
-               my $class;
                if ($cell =~ s/^\.//) {
                        # dot indicates start of a new row
                        push @rows, '';
@@ -80,30 +79,37 @@ sub glyph_table {
                my $name = $diinfo->{$code}->[1];
 
                # determine display class
-               if ($cell =~ s/^-//) {
-#                      $class = 'Empty';
+               my @class;
+               if ($cell eq '-') {
+                       $cell = '';
                }
                elsif ($cell eq '=') {
-                       $class = 'Reserved';
+                       push @class, 'di-invalid';
                        $cell = '';
                }
-               elsif ($cell =~ /[ -~]/) {
-                       $class = 'Ascii';
-               }
-               elsif (not $code) {
-                       $class = 'DiNone';
-               }
-               elsif ($diinfo->{$code}->[2] =~ /\bXz\b/) {
-                       $class = 'DiProp';
-               }
                else {
-                       $class = 'Di';
+                       if ($cell =~ s/^-//) {
+                               push @class, 'di-rare'; # discouraged
+                       }
+
+                       if ($code) {
+                               push @class, 'di-d'; # digraph
+                               push @class, 'di-prop' # unofficial
+                                       if $diinfo->{$code}->[2] =~ /\bXz\b/;
+                       }
+
+                       if ($cell =~ /[ -~]/) {
+                               push @class, 'di-a'; # ascii
+                       }
+                       else {
+                               push @class, 'di-b'; # basic unicode
+                       }
                }
 
                # add cell html
                $rows[-1] .= sprintf('<td%s%s%s>%s%s',
                        defined $name  ? qq{ title="$name"}  : '',
-                       defined $class ? qq{ class="$class"} : '',
+                       @class ? sprintf(' class="%s"', join ' ', @class) : '',
                        $colspan > 1 && qq{ colspan="$colspan"},
                        $cell eq '' ? '&nbsp;' : quote($cell),
                        $code ne '' ? sprintf(' <small class="digraph">%s</small>', quote($code))