codec: derive column groups from generation sequence
[sheet.git] / codec.plp
index b2c3407f930af9c9e18e8f8c767fe25633b55d32..4251df9239cf9b95e16d585a21df325ecad57f51 100644 (file)
--- a/codec.plp
+++ b/codec.plp
@@ -31,16 +31,22 @@ my %BOOLSCORE = (y => [5, '✔'], n => [1, '✘'], 0 => [0, 'n/a']);
 
 <div class="section">
 <table class="mapped">
-       <col><colgroup span=3><colgroup span=2><colgroup span=3>
-<thead><tr><th rowspan=2>feature
 <:
 my @codecs = sort {
        $info->{codec}->{$a}->{available} <=> $info->{codec}->{$b}->{available}
 } keys $info->{codec}->%*;
+my @codeccols = @{$info->{codec}}{@codecs};
 
-print '<th>', $_->{name} for @{$info->{codec}}{@codecs};
-print "\n<tr>";
-print '<td>', $_->{available} for @{$info->{codec}}{@codecs};
+{
+       print '<col>';
+       my @spans;
+       $spans[ $_->{generation} ]++ for @codeccols;
+       print "<colgroup span=$_>" for @spans;
+}
+say '<thead><tr><th rowspan=2>';
+say "\t", '<th>', $_->{name} for @codeccols;
+print '<tr>';
+print '<td>', $_->{available} for @codeccols;
 say '</thead>';
 
 while (defined (my $feat = shift @feat)) {