3 my ($page, @feat) = split m{/+}, $Request || 'image';
4 $page !~ /\W/ or Html(), Abort('Invalid codec type request', 400);
5 @feat or @feat = 'default';
6 my $title = "$page codecs";
7 my $info = eval { Data("codec-$page") };
13 title => "$title cheat sheet",
15 description => $info->{intro},
16 keywords => [@{ $info->{keywords} // [] }, qw' feature comparison support benchmark '],
17 data => ["codec-$page.inc.pl"],
18 raw => '<style>td,th {width:8%} tbody th {white-space:nowrap}</style>',
22 or Abort("Requested codec type <q>$page</q> not available", '404 request not found');
24 say "<h1>\u$title</h1>";
25 say "<p>$_</p>" for $info->{intro} // ();
27 my %BOOLSCORE = (y => [5, '✔'], n => [1, '✘'], 0 => [0, 'n/a']);
31 <table class="mapped">
34 $info->{codec}->{$a}->{available} <=> $info->{codec}->{$b}->{available}
35 } keys $info->{codec}->%*;
36 my @codeccols = @{$info->{codec}}{@codecs};
41 $spans[ $_->{generation} ]++ for @codeccols;
42 print "<colgroup span=$_>" for @spans;
44 say '<thead><tr><th rowspan=2>';
45 say "\t", '<th>', $_->{name} for @codeccols;
47 print '<td>', $_->{available} for @codeccols;
50 while (defined (my $feat = shift @feat)) {
51 my $featinfo = $info->{feature}->{$feat} or next;
52 unshift @feat, @{$_} for $featinfo->{children} // ();
53 $featinfo->{score} or next;
54 print '<tbody>' if $featinfo->{children};
55 printf '<tr><th>%s', $featinfo->{name} // $feat;
57 my ($score, $data, $title) = map { ref ? @$_ : $_ } $featinfo->{score}->{$_};
58 if (not defined $data) {
59 if (my $override = $BOOLSCORE{$score}) {
60 ($score, $data) = @{$override};
63 $data = '•' x ($score - 1);
66 printf '<td class="l%d"', $score;
67 printf ' title="%s"', EscapeHTML($_) for $title // ();