2 use List::Util qw(sum max first);
5 title => 'Shell compatibility cheat sheet',
7 stylesheet => [qw'circus dark mono red light'],
8 data => ['shell.inc.pl'],
11 say "<h1>Shell compatibility</h1>\n";
13 my $data = Data('shell');
14 my @agents = keys %{ $data->{agents} };
16 print '<table class="mapped">';
17 print '<col>'; # should match first thead row
18 printf '<colgroup span="%d">', 1 for @agents;
19 say '</colgroup><col>';
27 sprintf ' title="%s"', Entity($_)
28 } $data->{agents}->{$_}->{name} // ()),
33 print '<thead>', $header;
35 say '<tfoot>', $header;
39 print '<td>', Entity($row->{title});
51 my ($row, $agent) = @_;
52 my $support = $row->{support}->{$agent};
54 !defined $support ? 'l1' :
55 ref $support ne 'HASH' ? 'l0' :
56 $support->{alt} ? 'l2' :
57 $support->{partial} ? 'l3' :
58 $support->{optional} ? 'l4' :
62 defined $support ? 'supported' : 'unsupported',
63 'in', $data->{agents}->{$agent}->{abbr} // $agent,
66 for ref $support && ($support->{note} // $support->{optional}) || ();
67 my $header = defined $support ? '✔' : '✘';
68 printf('<td class="%s" title="%s">%s',
69 join(' ', X => $level),
71 $TSTATS{$level} // (ref $support ? '?' : $support),
77 $a->{title} cmp $b->{title}
78 } @{ $data->{feature} }) {
79 (my $id = lc $row->{title}) =~ s/\W+/-/g;
80 printf '<tr id="%s">', $id;
82 saysupportcols($row, $_) for @agents;