2 use List::Util qw(sum max first);
5 title => 'Shell compatibility cheat sheet',
7 data => ['shell.inc.pl'],
10 say "<h1>Shell compatibility</h1>\n";
12 my $data = Data('shell');
13 my @agents = keys %{ $data->{agents} };
15 print '<table class="mapped">';
16 print '<col>'; # should match first thead row
17 printf '<colgroup span="%d">', 1 for @agents;
18 say '</colgroup><col>';
26 sprintf ' title="%s"', Entity($_)
27 } $data->{agents}->{$_}->{name} // ()),
32 print '<thead>', $header;
34 say '<tfoot>', $header;
38 print '<td>', Entity($row->{title});
50 my ($row, $agent) = @_;
51 my $support = $row->{support}->{$agent};
53 !defined $support ? 'l1' :
54 ref $support ne 'HASH' ? 'l0' :
55 $support->{alt} ? 'l2' :
56 $support->{partial} ? 'l3' :
57 $support->{optional} ? 'l4' :
61 defined $support ? 'supported' : 'unsupported',
62 'in', $data->{agents}->{$agent}->{abbr} // $agent,
65 for ref $support && ($support->{note} // $support->{optional}) || ();
66 my $header = defined $support ? '✔' : '✘';
67 printf('<td class="%s" title="%s">%s',
68 join(' ', X => $level),
70 $TSTATS{$level} // (ref $support ? '?' : $support),
76 $a->{title} cmp $b->{title}
77 } @{ $data->{feature} }) {
78 (my $id = lc $row->{title}) =~ s/\W+/-/g;
79 printf '<tr id="%s">', $id;
81 saysupportcols($row, $_) for @agents;