digraphs: reclassify vim support levels
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 23 Mar 2017 01:31:15 +0000 (02:31 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 23 Mar 2017 02:25:58 +0000 (03:25 +0100)
Instead of custom u-* classes, reuse common l1-5 in include:

.u-di      → l4 (vim + rfc)
.u-prop    → l3 (vim)
.u-prop.ex → l2 (shiar)
.ex        → l1 (rfc only)

Prepend u- on page to avoid conflicting with script styling (leave
background colour unaltered).

Loses ascii/latin1 distinction, but clarifies (vim) compatibility and
allows for easier extension later on.

base.css
digraphs.plp
tools/mkdigraphlist

index fe9a6b2..3b196fc 100644 (file)
--- a/base.css
+++ b/base.css
@@ -344,12 +344,7 @@ table.dimap {
 /* character properties */
 
 .X  {background: #FFF} /* unidentified */
-#digraphs .Xa {color: #0A0} /* ascii */
-#digraphs .Xl {color: #070} /* latin1 */
-#digraphs .u-prop {color: #D00} /* proposed */
-#digraphs .u-prop.ex {color: #D88; color: rgba(221, 0, 0, .5)} /* unofficial proposal */
-
-.Lm, .Mc, .Me, .Zl, .Zp {background: #F00} /* unstyled */
+.Mc, .Me, .Zl, .Zp      {background: #F00} /* unstyled */
 .X > span               {background: #898; background: rgba(0, 0, 0, .25)} /* invisible contents */
 
 /* letter scripts */
@@ -402,6 +397,12 @@ table.dimap {
 .ex {     color: #888; color: rgba(0, 0, 0, .5)} /* experimental, disfavoured */
 .u-invalid {background: #BBB} /* invalid, impossible */
 
+/* foreground representation */
+#digraphs .u-l3 {color: #080} /* partial */
+#digraphs .u-l2 {color: #A44; color: rgba(128, 0, 0, .6)} /* unofficial proposal */
+#digraphs .u-l1 {color: #D00; color: rgba(255, 0, 0, .8)} /* minimal or invalid */
+
+/* support percentage (browser cells) */
 .p0         {opacity: .6}
 .p0.p       {opacity: 1}
 .p::after   {content: '!'; color: #F00}
@@ -433,7 +434,6 @@ table.dimap {
 .sy-todo       { background-color: #FF0 }
 
 /* hover effects */
-.u-di,
 .X:hover {cursor: help}
 .X:hover > span                            {background: #FFF} /* whitespace marker */
 .Greek:hover, .Armenian:hover              {background: #FA8}
@@ -463,15 +463,15 @@ table.dimap {
 .Co:hover                                  {background: #A77} /* private */
 .Xr:hover                                  {background: #FFF} /* reserved */
 .Xi:hover                                  {background: #DDD} /* invalid */
-.Xa:hover {outline: 1px solid #0F0} /* ascii */
-.Xl:hover {outline: 1px solid #0C0} /* latin1 */
-.u-prop:hover {outline: 1px solid #F00} /* proposed */
 .l0:hover                                  {background: #888}
 .l1:hover                                  {background: #F88}
 .l2:hover                                  {background: #FC8}
 .l3:hover                                  {background: #FF8}
 .l4:hover                                  {background: #CF8}
 .l5:hover                                  {background: #8F8}
+.u-l3:hover    {outline: 1px solid #0F0}
+.u-l2:hover    {outline: 1px solid #800}
+.u-l1:hover    {outline: 1px solid #F00}
 
 /* key type colorization */
 
index 887d1ab..4fff67d 100644 (file)
@@ -34,7 +34,7 @@ say join("\n",
        ),
        'Also see <a href="/unicode">common Unicode</a>.</p>',
 );
-say '<p class="aside">Unofficial <span class="u-prop ex">proposals</span>',
+say '<p class="aside">Unofficial <span class="u-l2">proposals</span>',
        ' are available as <a href="/digraphs.vim">ex commands</a>.' if not $mode;
 :>
 
@@ -114,12 +114,12 @@ for my $c1group (@chars) {
                                printf '<td class="X Xr" title="%s">', EscapeHTML($mnem);
                                next;
                        }
-                       my ($codepoint, $name, $prop, $script, $string) = @{ $di->{$mnem} };
+                       my ($codepoint, $name, $support, $script, $string) = @{ $di->{$mnem} };
 
                        my $glyph = $string || chr $codepoint;
                        utf8::upgrade($glyph);  # prevent latin1 output
                        my $desc = $mnem . ($name && " ($name)");
-                       my @class = ('X', grep {$_} $prop, $script);
+                       my @class = ('X', grep {$_} $support && "u-$support", $script);
 
                        $glyph = EscapeHTML($glyph);
                        $glyph = "<span>$glyph</span>" if $script =~ /\bZs\b/;
@@ -169,12 +169,10 @@ if ($mode) {
        </table>
 
        <table class="glyphs"><tr>
-       <td class="X">unicode
-       <td class="X Xl">latin1
-       <td class="X Xa">ascii
-       <td class="X u-prop">vim extension
-       <td class="X u-prop ex">proposal
-       <td class="X ex">not in vim
+       <td class="X u-l4">full support
+       <td class="X u-l3">vim extension
+       <td class="X u-l2">proposal
+       <td class="X u-l1">not in vim
        </table>
 </div>
 
index 216be6a..ab0c2f9 100755 (executable)
@@ -6,7 +6,7 @@ use utf8;
 
 use open OUT => ':utf8', ':std';
 
-our $VERSION = '1.05';
+our $VERSION = '1.06';
 
 # import and combine various digraph data
 my $rfc = do 'data/digraphs-rfc.inc.pl'
@@ -34,9 +34,9 @@ printf "q{%s}=>[%s],\n", s/(?=[\\}])/\\/gr, join(',',
        ord $di->{$_},   # original code point
        map {"'$_'"}
        $uninfo->{ $di->{$_} }->[1] // '',  # name
-       $vim->{$_}
-               ? $rfc->{$_} ? 'u-di' : 'u-prop'  # vim+rfc or vim only
-               : $rfc->{$_} ? 'ex'   : 'u-prop ex',  # rfc only or neither
+       $rfc->{$_}
+               ? $vim->{$_} ? 'l4' : 'l1'  # vim+rfc or rfc only
+               : $vim->{$_} ? 'l3' : 'l2',  # vim only or neither
        ($uninfo->{ $di->{$_} }->[0] // '') =~ s/ u-di| u-prop| ex//gr,  # class
        $uninfo->{ $di->{$_} }->[4] // (),  # string
 ) for sort keys %{$di};