termcol: named function to parse table data
[sheet.git] / termcol.plp
index 850ff83e9ccaf98bc67aef81593b70f592d77088..0000143f7e6f79d027ebb61db23761d25ba6fa67 100644 (file)
@@ -106,9 +106,11 @@ sub img_egapal {
        } || $@;
 }
 
-for my $term (@termlist) {
+sub coltable {
+       my ($term) = @_;
        my $info = $palettes->{$term};
        ref $info eq 'HASH' or next;
+
        my $caption = $info->{name} // $term;
        $caption = sprintf('<%s %s>%s</%1$s>',
                $info->{href} ? 'a' : 'span',
@@ -134,6 +136,12 @@ for my $term (@termlist) {
                        print '<tr>';
                        print colcell(@$_) for @$row;
                }
+
+               my $width = scalar @{ $table->[0] };
+               my @imgpal = map { [ @{$_}[1 .. 3] ] } map { @{$_} } @{$table};
+               for (@draw) {
+                       print "<tr><td colspan=$width>", img_egapal(\@imgpal, @{$_});
+               }
                print "</table>\n\n";
        }
 
@@ -244,6 +252,7 @@ sub coltable_hsv {
        return $out;
 }
 
+coltable($_) for @termlist;
 :></div>
 <hr>