From: Mischa POSLAWSKY Date: Sat, 11 Oct 2008 11:41:46 +0000 (+0000) Subject: unicode: set multiple property classes X-Git-Tag: v1.2~11 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/bba917e54169127218b3580c98686ba6aaf88fb4 unicode: set multiple property classes If several non-exclusive character attributes are present, set all relevant style classes (and try to show the most relevant). --- diff --git a/digraphs.css b/digraphs.css index 5593697..6d858e6 100644 --- a/digraphs.css +++ b/digraphs.css @@ -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} diff --git a/unicode.plp b/unicode.plp index 8dfe132..5e0327e 100644 --- a/unicode.plp +++ b/unicode.plp @@ -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('%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 '' ? ' ' : quote($cell), $code ne '' ? sprintf(' %s', quote($code))