git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
codec: page request overrides image type
[sheet.git]
/
codec.plp
diff --git
a/codec.plp
b/codec.plp
index 1ae734aee72c00659ec338ffa69ccd57e242a86c..2349b1dc9747085742c468318d9eb41501575bfd 100644
(file)
--- a/
codec.plp
+++ b/
codec.plp
@@
-1,24
+1,33
@@
<(common.inc.plp)><:
<(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";
Html({
Html({
- title =>
'Codecs'
,
+ title =>
"$title cheat sheet"
,
version => '1.0',
description => [
],
keywords => [qw'
version => '1.0',
description => [
],
keywords => [qw'
+ codec encoder encoding decode file format type mime
+ feature comparison support benchmark compression
+ image audio video
'],
stylesheet => [qw'light circus dark red'],
data => [qw'codec.inc.pl'],
'],
stylesheet => [qw'light circus dark red'],
data => [qw'codec.inc.pl'],
+ raw => '<style>td,th {width:10%} tbody th {white-space:nowrap}</style>',
});
});
-my $info = do 'codec.inc.pl';
-$info and %{$info} > 1 or Abort("cannot open operator include", 500, $@ // $!);
+my $info = do "codec-$page.inc.pl";
+$info and %{$info} > 1
+ or Abort("Requested codec type <q>$page</q> not available", '404 request not found', $@ // $!);
+
+say "<h1>\u$title</h1>";
my %BOOLSCORE = (y => [5, '✔'], n => [1, '✘'], 0 => [0, 'n/a']);
:>
my %BOOLSCORE = (y => [5, '✔'], n => [1, '✘'], 0 => [0, 'n/a']);
:>
-<h1>Image codecs</h1>
<div class="section">
<table class="mapped">
<div class="section">
<table class="mapped">
@@
-41,7
+50,7
@@
while (defined (my $feat = shift @feat)) {
print '<tbody>' if $featinfo->{children};
printf '<tr><th>%s', $featinfo->{name} // $feat;
for (@codecs) {
print '<tbody>' if $featinfo->{children};
printf '<tr><th>%s', $featinfo->{name} // $feat;
for (@codecs) {
- my ($score, $data) = map { ref ? @$_ : $_ } $featinfo->{score}->{$_};
+ my ($score, $data
, $title
) = map { ref ? @$_ : $_ } $featinfo->{score}->{$_};
if (not defined $data) {
if (my $override = $BOOLSCORE{$score}) {
($score, $data) = @{$override};
if (not defined $data) {
if (my $override = $BOOLSCORE{$score}) {
($score, $data) = @{$override};
@@
-50,7
+59,9
@@
while (defined (my $feat = shift @feat)) {
$data = '•' x ($score - 1);
}
}
$data = '•' x ($score - 1);
}
}
- printf '<td class="l%d">%s', $score, $data;
+ printf '<td class="l%d"', $score;
+ printf ' title="%s"', $_ for $title // ();
+ print '>', $data;
}
say '</td>';
}
}
say '</td>';
}