X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/19420d8dd160ff036401c4d245e54712f5d59b7e..81aefba6ac586eccbe18b4e90efc175e34fff5ad:/browser.plp diff --git a/browser.plp b/browser.plp index ad8690f..782bea8 100644 --- a/browser.plp +++ b/browser.plp @@ -6,7 +6,7 @@ no if $] >= 5.018, warnings => 'experimental::smartmatch'; Html({ title => 'browser compatibility cheat sheet', - version => 'v1.2', + version => '1.3', description => [ "Compatibility table of new web features (HTML5, CSS3, SVG, Javascript)", "comparing support and usage share for all popular browser versions.", @@ -22,7 +22,7 @@ Html({ say "

Browser compatibility

\n"; -my $caniuse = do 'data/browser/support.inc.pl' or die $! || $@; +my $caniuse = do 'data/browser/support.inc.pl' or die $@ || $!; $_->{verrelease} = { # mark last three (future) versions as unreleased, ensure current isn't map { @@ -58,7 +58,9 @@ my %DSTATS = ( x => sub { join(' ', 'requires prefix', - (map "-$_-", $caniuse->{agents}->{$_[0]}->{prefix} // ()), + map {"-$_-"} + ($caniuse->{agents}->{$_[0]}->{prefix_exceptions} // {})->{$_[1]} + // $caniuse->{agents}->{$_[0]}->{prefix} // (), ); }, ); @@ -99,7 +101,7 @@ given ($get{usage} // 'wm') { 'identifier must be alphanumeric name or 0'; } $canihas = do "data/browser/usage-$_.inc.pl" or do { - printf "

Browser usage data not found: %s", $! || $@; + printf "

Browser usage data not found: %s", $@ || $!; break; }; $usage = $_; @@ -270,6 +272,7 @@ sub featurescore { while (my ($browser, $versions) = each %$row) { ref $versions eq 'HASH' or next; while (my ($version, $status) = each %$versions) { + $status =~ s/\h\#\d+//; $rank += ($canihas->{$browser}->{$version} || .001) * $PSTATS{$status}; } } @@ -297,6 +300,7 @@ sub featurescore { sub formatnotes { my @html = @_; for (@html) { + s/\r\n?/\n/g; # windows returns s/\h* $//gmx; # trailing whitespace s/(?<= [^.\n]) $/./gmx; # consistently end each line by a period Entity($_); @@ -386,7 +390,7 @@ sub saybrowsercols { # prepare version hover details my $title = sprintf('%.1f%% %s', $usage * $usagepct, join(', ', - map { ref $_ eq 'CODE' ? $_->($browser) : $_ } + map { ref $_ eq 'CODE' ? $_->($browser, $span[0]->[0]) : $_ } map { $DSTATS{$_} // () } map { split / /, $_ } $prev