codec: categorise related features in groups
[sheet.git] / codec.plp
index 2cc454ad3f20bd3c830b4c14eceeec84ced0f1fc..27a6cb73960bd54f1d7f88f8177239d4aa41598f 100644 (file)
--- a/codec.plp
+++ b/codec.plp
@@ -1,5 +1,7 @@
 <(common.inc.plp)><:
 
+my @feat = split m{/+}, $Request || 'default';
+
 Html({
        title => 'Codecs',
        version => '1.0',
@@ -32,9 +34,11 @@ print "\n<tr>";
 print '<td>', $_->{available} for @{$info->{codec}}{@codecs};
 say '</thead>';
 
-print '<tbody>';
-for my $feat (sort keys %{$info->{feature}}) {
-       my $featinfo = $info->{feature}->{$feat};
+while (defined (my $feat = shift @feat)) {
+       my $featinfo = $info->{feature}->{$feat} or next;
+       unshift @feat, @{$_} for $featinfo->{children} // ();
+       $featinfo->{score} or $featinfo->{data} or next;
+       print '<tbody>' if $featinfo->{children};
        printf '<tr><th>%s', $featinfo->{name} // $feat;
        printf('<td class="l%d">%s',
                (map { $_ && $BOOLSCORE{$_} || $_ || 0 } $featinfo->{score}->{$_}),