X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/c3ef3326d8ca3d9209afd34f6220f78b1eb0dbc2..8f768b6ed17048f182cde20a621758cdbd3b72bb:/codec.plp diff --git a/codec.plp b/codec.plp index 35b97ed..2e50794 100644 --- a/codec.plp +++ b/codec.plp @@ -16,7 +16,7 @@ Html({ my $info = do 'codec.inc.pl'; $info and %{$info} > 1 or Abort("cannot open operator include", 500, $@ // $!); -my %BOOLSCORE = (y => 5, n => 1); +my %BOOLSCORE = (y => [5, '✔'], n => [1, '✘'], 0 => [0, 'n/a']); :>

Image codecs

@@ -37,15 +37,23 @@ say ''; 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; + $featinfo->{score} or next; print '' if $featinfo->{children}; printf '%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 ''; }