termcol: omit table tags from coltable_hsv() output
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 1 Nov 2015 03:05:06 +0000 (04:05 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 5 Jan 2016 00:05:07 +0000 (01:05 +0100)
Require manual container setup so e.g. captions can be added.

termcol.plp

index 9262bf35c64a090ccf9e1c8b32c70540060c9893..e34ceada9d45204cf9af827be33092b71fe5f069 100644 (file)
@@ -261,7 +261,7 @@ sub coltable_hsv {
                }
        }
 
-       my $out = '<table class=mapped>';
+       my $out = '';
        $out .= sprintf '<colgroup span=%d>', 3 * @{$_} for @colmap;
        my $huerow = $colmap[0][0]; # first {$_} map { @{$_} } @colmap;
        for my $h (grep { $huerow->[$_] } 0 .. $#{$huerow}) {
@@ -279,25 +279,28 @@ sub coltable_hsv {
                $out .= '<tr>' unless $col++ % $colbreak;
                $out .= colcell($num, ($greymap{$num}) x 3);
        }
-       $out .= "</table>\n\n";
 
        return $out;
 }
 
 {
        print "<h2>88-colour space</h2>\n";
+       print "<table class=mapped>\n";
        print coltable_hsv(4,
                sub {(0, 139, 205, 255)[$_[0]]},
                [map { ($_ + 2 + ($_>0)) * 255/11 } 0 .. 7],
        );
+       print "</table>\n";
 }
 
 if ($ENV{PATH_INFO} =~ /256/) {
        print "<h2>256-colour space</h2>\n";
+       print "<table class=mapped>\n";
        print coltable_hsv(6,
                sub { $_[0] && $_[0]*40 + 55 },
                [ map { $_ * 10 + 8 } 0 .. 23 ],
        );
+       print "</table>\n";
 }
 :></div>
 <hr>