:>.
</p>
-<div id="browser">
<:
my $caniuse = do 'browser-support.inc.pl' or die $! || $@;
$_->{verrelease} = {
cr => 'l4', # candidate
pr => 'l4', # proposed
rec => 'l5', # recommendation
- other => 'l5', # non-w3
+ other => 'l2', # non-w3
ietf => 'l5', # standard
);
my %versions;
) for @{ $versions{$browser} };
}
print '<td>' x 1;
-print "</thead>\n";
+say '</thead>';
+say '<tfoot>', $header, '</tfoot>';
sub featurescore {
# relative amount of support for given feature
- state $statspts = { y=>10, 'y x'=>10, a=>5, 'a x'=>5, j=>2, 'p j'=>2, p=>1 };
+ state $statspts = { y=>10, 'y x'=>10, a=>5, 'a x'=>5, j=>2, 'p j'=>2, 'p p'=>2, p=>1 };
my $rank = 0;
if (my $row = shift) {
if ($canihas) {
while (my ($browser, $versions) = each %$row) {
ref $versions eq 'HASH' or next;
while (my ($version, $_) = each %$versions) {
- $rank += $canihas->{$browser}->{$version} * $statspts->{$_};
+ $rank += ($canihas->{$browser}->{$version} || .001) * $statspts->{$_};
}
}
return $rank;
for ($row->{categories}) {
my $cell = $_ ? lc $_->[0] : '-';
- print '<th>', $cell;
+ printf '<th title="%s">%s', join(' + ', @$_), $cell;
}
print '<td>', map {
sprintf("try { %s; return false } catch(err) { return true }",
"document.getElementById('$id').classList.toggle('target')",
),
- $_,
+ Entity($_),
);
} $row->{title};
print '<div class=aside>';
s/\.?$/./, print "<p>$_</p>" for map { ref $_ ? @$_ : $_ || () }
- $row->{description}, $row->{notes};
- printf 'Resources: %s.', join(', ',
- map { qq(<a href="$_->{url}">$_->{title}</a>) } @$_
- ) for grep { @$_ } $row->{links} // ();
+ Entity($row->{description}), formathtml($row->{notes}); # sic
+ printf 'Resources: %s.', join(', ', map {
+ sprintf '<a href="%s">%s</a>', EscapeHTML($_->{url}), $_->{title}
+ } @$_) for grep { @$_ } $row->{links} // ();
print '</div>';
}
print '<td>', int featurescore($caniuse->{data}->{$id}->{stats}) / $maxscore * 100;
}
+say '<tbody>';
for my $id (sort {
featurescore($caniuse->{data}->{$b}->{stats})
<=> featurescore($caniuse->{data}->{$a}->{stats})
sayusagecol($id);
say '</tr>';
}
-print '<tfoot>', $header;
-print '</table>';
+say '</tbody>';
+say '</table>';
+
+sub formathtml {
+ my $ref = defined wantarray ? [@_] : \@_;
+ for (@$ref) {
+ s/& (?!\w)/&/gx;
+ s/< \s/</gx;
+ s/\n\K\n/<br>/g;
+ }
+ return @$ref;
+}
sub paddedver {
# normalised version number comparable as string (cmp)
return join('‒', @span);
}
-:></div>
-
+:>
<hr>
<div class="legend">
<td class="X l2">external (js/plugin)
<td class="X l1">missing
<td class="X l0">unknown
- <td class="X l0 ex">prefixed
+ <td class="X ex">prefixed
</table>
<p><: if ($usage) { :>
</div>
</div>
-<script src="/searchlocal.js"></script>
-<script> prependsearch(document.getElementById('intro')) </script>
+<script type="text/javascript" src="/searchlocal.js"></script>
+<script type="text/javascript"> prependsearch(document.getElementById('intro')) </script>