termcol: reindent table handling code
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 2 May 2017 20:36:47 +0000 (22:36 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 29 May 2017 17:23:11 +0000 (19:23 +0200)
termcol.plp

index a090fc7ffe7a36ee3583b570abf1863d92cf338d..3880a62ecd46bca9ff202616ba3ecd1032df0661 100644 (file)
@@ -134,24 +134,24 @@ sub coltable {
                print coltable_hsv(@{$_}) for $info->{rgbmap} || ();
 
                if (my $table = $info->{table}) {
                print coltable_hsv(@{$_}) for $info->{rgbmap} || ();
 
                if (my $table = $info->{table}) {
-               for my $row (@$table) {
-                       if (!$row) {
-                               say '<tbody>';
-                               next;
+                       for my $row (@$table) {
+                               if (!$row) {
+                                       say '<tbody>';
+                                       next;
+                               }
+                               print '<tr>';
+                               print colcell(ref $_ ? @$_ : $_ ? reverse split /:/ : undef) for @$row;
                        }
                        }
-                       print '<tr>';
-                       print colcell(ref $_ ? @$_ : $_ ? reverse split /:/ : undef) for @$row;
-               }
 
 
-       if (@draw) {
-               my $width = scalar @{ $table->[0] };
-               my @imgpal = map {
-                       [ ref $_ ? @{$_}[1 .. 3] : map {hex} /(..)(..)(..)/ ]
-               } map { @{$_} } @{$table};
-               for (@draw) {
-                       print "<tr><td colspan=$width>", img_egapal(\@imgpal, @{$_});
-               }
-       }
+                       if (@draw) {
+                               my $width = scalar @{ $table->[0] };
+                               my @imgpal = map {
+                                       [ ref $_ ? @{$_}[1 .. 3] : map {hex} /(..)(..)(..)/ ]
+                               } map { @{$_} } @{$table};
+                               for (@draw) {
+                                       print "<tr><td colspan=$width>", img_egapal(\@imgpal, @{$_});
+                               }
+                       }
                }
 
                say "</table>\n";
                }
 
                say "</table>\n";