From: Mischa POSLAWSKY Date: Sat, 8 Apr 2017 21:33:21 +0000 (+0200) Subject: charset: realsize option to keep utf-8 table unabbreviated X-Git-Tag: v1.10~197 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/6bf3cfbf5a62745381ebb3f6c5ee72eabd8366f5?ds=sidebyside charset: realsize option to keep utf-8 table unabbreviated Hardcoded rowspans break with recently introduced row abbreviation. --- diff --git a/charset.plp b/charset.plp index 74ea8e7..e82e3d7 100644 --- a/charset.plp +++ b/charset.plp @@ -77,7 +77,7 @@ sub tabinput { my $input = shift or return; state $ALIAS = { - default => [qw( unicode+0-639 utf-8 iso-8859-1 iso-8859-15 cp1252 cp437 cp850 )], + default => [qw( unicode+0-639 utf-8+realsize iso-8859-1 iso-8859-15 cp1252 cp437 cp850 )], uc => [qw( U+cols=32 unicode+0-4095 unicode+4096-6319 unicode+6320-8191 )], us => [qw( cp437 cp863 gsm0338 AdobeStandardEncoding )], ebcdic => [qw( cp37 cp500 cp1047 posix-bc cp1026 cp875 )], @@ -222,7 +222,10 @@ sub tabinput { } for my $param (split /[+]+/, $params // '') { - if ($param =~ m{ \A cols = (\d+) \z }x) { + if ($param eq 'realsize') { + $row{realsize}++; + } + elsif ($param =~ m{ \A cols = (\d+) \z }x) { $row{cols} = $1; } elsif ($param =~ m{ \A (? \d+) (?: [-] (? \d+) )? \z }x) { @@ -361,13 +364,15 @@ sub range_cell { $class .= ' joind'; } - # coalesce multiple rows - while ($rows > 3) { - $info->{skip}->{$offset += $rowsize}++; - $rows--; - } - if ($rows > 2) { - $info->{skip}->{$offset += $rowsize} = 0; + unless ($info->{realsize}) { + # coalesce multiple rows + while ($rows > 3) { + $info->{skip}->{$offset += $rowsize}++; + $rows--; + } + if ($rows > 2) { + $info->{skip}->{$offset += $rowsize} = 0; + } } $attr .= sprintf ' rowspan=%d', $rows;