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";
9 title => "$title cheat sheet",
14 codec encoder encoding decode file format type mime
15 feature comparison support benchmark compression
18 stylesheet => [qw'light circus dark red'],
19 data => [qw'codec.inc.pl'],
20 raw => '<style>td,th {width:10%} tbody th {white-space:nowrap}</style>',
23 my $info = do "codec-$page.inc.pl";
24 $info and %{$info} > 1
25 or Abort("Requested codec type <q>$page</q> not available", '404 request not found', $@ // $!);
27 say "<h1>\u$title</h1>";
29 my %BOOLSCORE = (y => [5, '✔'], n => [1, '✘'], 0 => [0, 'n/a']);
33 <table class="mapped">
34 <col><colgroup span=3><colgroup span=2><colgroup span=3>
35 <thead><tr><th rowspan=2>feature
38 $info->{codec}->{$a}->{available} <=> $info->{codec}->{$b}->{available}
39 } keys $info->{codec}->%*;
41 print '<th>', $_->{name} for @{$info->{codec}}{@codecs};
43 print '<td>', $_->{available} for @{$info->{codec}}{@codecs};
46 while (defined (my $feat = shift @feat)) {
47 my $featinfo = $info->{feature}->{$feat} or next;
48 unshift @feat, @{$_} for $featinfo->{children} // ();
49 $featinfo->{score} or next;
50 print '<tbody>' if $featinfo->{children};
51 printf '<tr><th>%s', $featinfo->{name} // $feat;
53 my ($score, $data, $title) = map { ref ? @$_ : $_ } $featinfo->{score}->{$_};
54 if (not defined $data) {
55 if (my $override = $BOOLSCORE{$score}) {
56 ($score, $data) = @{$override};
59 $data = '•' x ($score - 1);
62 printf '<td class="l%d"', $score;
63 printf ' title="%s"', $_ for $title // ();