X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/1676865de8be5f051b97cc3d4b4fcc959732d3ef..b13bb406f89eaebf04c8fd8ffe69cde30d5aa0bd:/codec.plp?ds=inline
diff --git a/codec.plp b/codec.plp
index 27a6cb7..f13b93a 100644
--- a/codec.plp
+++ b/codec.plp
@@ -1,51 +1,73 @@
<(common.inc.plp)><:
-my @feat = split m{/+}, $Request || 'default';
+my ($page, @feat) = split m{/+}, $Request || 'image';
+$page !~ /\W/ or Html(), Abort('Invalid codec type request', 400);
+@feat or @feat = 'default';
+my $title = "$page codecs";
+my $info = eval { Data("codec-$page") };
+if ($@) {
+ $info = {};
+}
Html({
- title => 'Codecs',
- version => '1.0',
- description => [
- ],
- keywords => [qw'
- '],
+ title => "$title cheat sheet",
+ version => '1.1',
+ description => $info->{intro},
+ keywords => [@{ $info->{keywords} // [] }, qw' feature comparison support benchmark '],
stylesheet => [qw'light circus dark red'],
- data => [qw'codec.inc.pl'],
+ data => ["codec-$page.inc.pl"],
+ raw => '',
});
-my $info = do 'codec.inc.pl';
-$info and %{$info} > 1 or Abort("cannot open operator include", 500, $@ // $!);
+%{$info}
+ or Abort("Requested codec type $page
not available", '404 request not found');
+
+say "
$_
" for $info->{intro} // (); -my %BOOLSCORE = (y => 5, n => 1); +my %BOOLSCORE = (y => [5, 'â'], n => [1, 'â'], 0 => [0, 'n/a']); :> -feature <: my @codecs = sort { $info->{codec}->{$a}->{available} <=> $info->{codec}->{$b}->{available} } keys $info->{codec}->%*; +my @codeccols = @{$info->{codec}}{@codecs}; -print ' | ', $_->{name} for @{$info->{codec}}{@codecs}; -print "\n | ||
---|---|---|---|
', $_->{available} for @{$info->{codec}}{@codecs};
+{
+ print '';
+say "\t", ' | ', $_->{name} for @codeccols;
+print ' | ', $_->{available} for @codeccols;
say ' | |
%s', $featinfo->{name} // $feat; - printf(' | %s', - (map { $_ && $BOOLSCORE{$_} || $_ || 0 } $featinfo->{score}->{$_}), - $featinfo->{data}->{$_} // (map { - $BOOLSCORE{$_} ? ($_ eq 'y' ? 'â' : 'â') : 'â¢' x ($_ - 1) - } $featinfo->{score}->{$_}), - ) for @codecs; + for (@codecs) { + my ($score, $data, $title) = map { ref ? @$_ : $_ } $featinfo->{score}->{$_}; + if (not defined $data) { + if (my $override = $BOOLSCORE{$score}) { + ($score, $data) = @{$override}; + } + else { + $data = 'â¢' x ($score - 1); + } + } + printf ' | ', $data; + } say ' | '; }