X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/b3b23b8e45537cadbfc4b5d4e939f145931e0a4b..e1a705660758f0d1b2520717c8fd0823d7347e50:/browser.plp?ds=sidebyside diff --git a/browser.plp b/browser.plp index dcc7688..6d75d4a 100644 --- a/browser.plp +++ b/browser.plp @@ -4,7 +4,7 @@ no if $] >= 5.018, warnings => 'experimental::smartmatch'; Html({ title => 'browser compatibility cheat sheet', - version => '1.5', + version => '1.6', description => [ "Compatibility table of new web features (HTML5, CSS3, SVG, Javascript)", "comparing support and usage share for all popular browser versions.", @@ -20,14 +20,7 @@ Html({ say "
0.', ]); } - $canihas = do "data/browser/usage-$_.inc.pl" or do { - Alert('Browser usage data not found', $@ || $!); + $canihas = eval { Data("data/browser/usage-$_") } or do { + Alert('Browser usage data not found', $@); break; }; $usage = $_; @@ -198,7 +191,10 @@ $canihas ||= { # score multiplier for percentage of all browser versions my $usagepct = 99.99 / sum( - map { $_->{-total} // values %{$_} } values %{$canihas} + map { $_->{-total} // values %{$_} } + map { $canihas->{$_} } + grep { !/^-/ } + keys %{$canihas} ); $_->{usage} = featurescore($_->{stats}) * $usagepct @@ -237,13 +233,15 @@ print "\n
$1
}gx;
+ s{ \(\K (?: \Qhttps://caniuse.com\E )? (?: /? \#feat= | / ) }{#}gx;
s{ \[ ([^]]*) \] \( ([^)]*) \) }{$1}gx;
}
return @html;
@@ -375,9 +377,9 @@ sub saybrowsercols {
my $data = $feature->{stats}->{$browser};
if (ref $data eq 'ARRAY') {
# special case for unsupported
- my $release = $caniuse->{agents}->{$browser}->{verrelease};
$data = {
- map { $_ => defined $release->{$_} ? 'u' : 'n' } keys %$release
+ map { $_ => 'n' }
+ keys %{ $caniuse->{agents}->{$browser}->{version_list} }
};
}
@@ -386,15 +388,15 @@ sub saybrowsercols {
my $compare = (
!defined $ver ? undef : # last column if nameless
ref $data ne 'HASH' ? '' : # unclassified if no support hash
- $data->{ $ver->[-1] } // $prev # known or inherit from predecessor
- // (grep { defined } @{$data}{ map { $_->[0] } @{ $versions{$browser} } })[0]
- ~~ 'n' && 'n' # first known version is unsupported
+ (first { defined } @{$data}{ reverse @{$ver} }) # last known version
+ // $prev # inherit from predecessor
|| 'u' # unsure
);
- unless (!defined $prev or $prev ~~ $compare) {
- my @vercover = (map { @{$_} } @span);
+ if (defined $prev and not $prev ~~ $compare) {
+ # different columns
+ my @vercover = (map { @{$_} } @span); # accumulated conforming versions
for ($ver ? @{$ver} : ()) {
- $data->{$_} eq $data->{$vercover[-1]} or last;
+ last if defined $data->{$_}; # until different
push @vercover, $_; # matches from next span start
}
my $usage = sum(@{ $canihas->{$browser} }{@vercover});
@@ -416,6 +418,7 @@ sub saybrowsercols {
));
$title .= "\n$_" for notestotitle(@notes);
+ $prev .= ' #' if @notes and $prev =~ /^y/;
printf('supported + | annotated | partial | optional | missing |