From: Mischa POSLAWSKY Date: Wed, 11 Feb 2015 22:01:46 +0000 (+0100) Subject: writing: highlight cells according to unicode version X-Git-Tag: v1.7~168 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/a605211aaba5d956789c1d30c09a55494858d086 writing: highlight cells according to unicode version --- diff --git a/Shiar_Sheet/FormatChar.pm b/Shiar_Sheet/FormatChar.pm index a3f4cc9..6b5fb6c 100644 --- a/Shiar_Sheet/FormatChar.pm +++ b/Shiar_Sheet/FormatChar.pm @@ -1,5 +1,6 @@ package Shiar_Sheet::FormatChar; +use 5.010; use strict; use warnings; @@ -70,7 +71,7 @@ sub cell { push @class, 'u-invalid'; $cell = ''; } - else { + else {{ push @class, 'X'; if ($input =~ s/^-//) { @@ -80,6 +81,30 @@ sub cell { $input =~ s/^\\//; # escaped char ($cell, $title, my $class, $mnem, $entity) = $self->glyphs_html($input); + if ($self->{style} eq 'univer') { + state $agemap = do 'unicode-age.inc.pl' or die $!; + my $version = $agemap->{ord $input}; + if (!$version) { + push @class, 'l1'; # no known unicode assignment + } + elsif ($version < 20) { + push @class, 'l5'; # first release 1993 + } + elsif ($version < 31) { + push @class, 'l4'; # 20th century + } + elsif ($version < 50) { + push @class, 'l4'; # over 10 years ago + } + elsif ($version < 61) { + push @class, 'l3'; # before 2012 + } + else { + push @class, 'l2'; # more recent + } + next; + } + if ($self->{style} eq 'di') { if ($class =~ /\bu-di\b/) { push @class, ('l3', 'u-di'); # standard digraph @@ -109,7 +134,7 @@ sub cell { else { push @class, 'l1'; # basic unicode } - } + }} my $anno = ''; if ($cell ne '') { diff --git a/digits.plp b/digits.plp index f688d05..1031151 100644 --- a/digits.plp +++ b/digits.plp @@ -29,7 +29,7 @@ my $glyphs = Shiar_Sheet::FormatChar->new; unless (exists $get{v}) { $glyphs->{unicode}--; $glyphs->{anno} = []; - $glyphs->{style} = 0; + $glyphs->{style} = 'univer'; } my $scriptname = do 'writing-script.inc.pl'; diff --git a/writing.plp b/writing.plp index c430bbd..8ea9a0c 100644 --- a/writing.plp +++ b/writing.plp @@ -32,7 +32,7 @@ my $glyphs = Shiar_Sheet::FormatChar->new; unless (exists $get{v}) { $glyphs->{unicode}--; $glyphs->{anno} = []; - $glyphs->{style} = 0; + $glyphs->{style} = 'univer'; } my $scriptname = do 'writing-script.inc.pl'; @@ -60,3 +60,14 @@ for (
+
+ +
unicode 1.1 + 20th century + in 6.0 (2010) + recent assignments + proposed + irregular +
+
+