charset: distinct column size per table
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 5 Apr 2017 23:20:04 +0000 (01:20 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 24 Apr 2017 23:51:42 +0000 (01:51 +0200)
Prevent unicode planes from affecting other tables.

charset-ucplanes.inc.pl
charset-unicode.inc.pl
charset.plp

index b954068f81dc4747c1dcfce40d6044932cec8678..45f271f37a00001ffb21da6b7fcdb3de0295d376 100644 (file)
@@ -1,5 +1,6 @@
 use utf8;
 +{
+       colsize => 8,
        0x0000 => [0x008, 'X Po',               'ascii'],
        0x0008 => [0x020, 'X L Latin',          'latin'],
        0x0028 => [0x010, 'X Mn',               'diac', 'diacritics'], # also spacing Sk
index 559ca88bb6894e257b77aad9444c008863fee25e..be082487478de497466987890674c4fe799fd0f7 100644 (file)
@@ -1,5 +1,7 @@
 use utf8;
 +{
+       colsize => 1,
+
        # bmp
        0x0000 => [0x02, 'X Cc joinr',         'control'],
        0x0002 => [0x02, 'X L Po joinl joinr', 'comn'],
index 9bdf363755462c1a679d816f14d3795a3e59a834..080e2085417c607035390b351bd7340e32286b5a 100644 (file)
@@ -22,7 +22,6 @@ Html({
 use Shiar_Sheet::FormatChar;
 my $glyphs = Shiar_Sheet::FormatChar->new;
 my $cols = 16;  # columns
-my $colsize = 1;  # increment per column
 
 # generate character table(s)
 # (~16x faster than decoding in loop;
@@ -67,7 +66,6 @@ my @request = map {
                        $row{set} = 'Unicode planes';
                        $row{cell} = do 'charset-ucplanes.inc.pl'
                                or Alert('Table data could not be read', $@ || $!);
-                       $colsize = 8;
                        $cols *= 2;
                }
                elsif ($row{set} = Encode::resolve_alias($input)) {
@@ -112,6 +110,7 @@ sub range_cell {
        my $def = $table->{$offset} or return;
        my ($len, $class, $name, $title) = @{$def};
 
+       my $colsize = $table->{colsize} || 1;
        my $attr = '';
        $len /= $colsize;
        $name //= $len <= 2 ? 'res' : 'reserved';
@@ -157,6 +156,7 @@ sub range_cell {
 }
 
 for my $row (@request) {
+       my $colsize = $row->{cell} && $row->{cell}->{colsize} || 1;
        printf '<div class="section"><table class="glyphs%s">', !$row->{cell} && ' charmap';
        my $title = $row->{set};
        $title .= " <aside>($_)</aside>" for $row->{setnote} // ();