From: Mischa POSLAWSKY Date: Sat, 8 Apr 2017 16:07:40 +0000 (+0200) Subject: charset: coalesce and abbreviate rowspan>3 X-Git-Tag: v1.10~205 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/96f5f211071a80ac3be647e502cbbb22f97d3db8 charset: coalesce and abbreviate rowspan>3 Hide useless whitespace of huge CJK blocks; only indicate start and end rows. --- diff --git a/charset.plp b/charset.plp index b1c680e..18d7c50 100644 --- a/charset.plp +++ b/charset.plp @@ -303,11 +303,22 @@ sub range_cell { } elsif (my $rows = int($len / $cols)) { # multiple full rows + my $rowsize = $colsize * $cols; if ($len -= $rows * $cols) { # partial row remains - $table->{$offset + $colsize*$rows * $cols} //= [$len*$colsize, "$class joinu", '', $title]; + $table->{$offset + $rowsize * $rows} //= [$len*$colsize, "$class joinu", '', $title]; $class .= ' joind'; } + + # coalesce multiple rows + while ($rows > 3) { + $info->{skip}->{$offset += $rowsize}++; + $rows--; + } + if ($rows > 2) { + $info->{skip}->{$offset += $rowsize} = 0; + } + $attr .= sprintf ' rowspan=%d', $rows; $len = $cols; } @@ -346,7 +357,10 @@ for my $row (@request) { } print ''; - { + if (defined $row->{skip}->{$offset}) { + print '⋮'; + } + else { if (my $rowmod = $offset % $rowdiv) { # offset in column units printf '+%X', $rowmod;