use List::Util qw( first pairfirst pairs );
state $INHERIT = {
- 'cp437' => ['cp850' => 0], # ascii range overridden later
+ 'cp437' => ['cp850' => 0, 'ascii' => '0-31+128'], # ascii range overridden later
'gsm0338' => ['ascii' => '0-127'],
'iso-8859-2' => ['iso-8859-1' => '160'],
}
elsif (defined $visible->{ascii}) {
$row{parent} = $parents[0];
- $params = $parents[1] || 128;
+ $params = $parents[1] // 128;
$params = 128 if $params >= 128; # ascii offset at most
}
elsif (@parents) {
$row{parent} = $parents[0];
+ $params = $parents[1] if $parents[1] == 0; # apply ascii end
}
- $visible->{$_} //= 0 for $row{parent};
+ $visible->{$_} //= 0 for $row{parent} || ();
+ }
+ else {
+ # manual option to double table width
+ $row{cols} *= 2 if $params =~ s/[+]\z//;
}
- if (defined $params) {
+ if (length $params) {
$params =~ m{
\A (?<offset> \d+)
(?: (?: [-] (?<stop> \d+) )? (?: [+] (?<restart> \d+) ) )?
}
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;
}
}
print '<tr><th>';
- {
+ if (defined $row->{skip}->{$offset}) {
+ print '⋮';
+ }
+ else {
if (my $rowmod = $offset % $rowdiv) {
# offset in column units
printf '<small>+%X</small>', $rowmod;