git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
browser: cleanup duplicate support determination
[sheet.git]
/
browser.plp
diff --git
a/browser.plp
b/browser.plp
index aaafa038cafb70129c858b60ab5f4f819ce43186..863f806f1e6990eeaf15f4bdb1af626c26c840f3 100644
(file)
--- a/
browser.plp
+++ b/
browser.plp
@@
-6,8
+6,10
@@
use List::Util qw(sum max first);
Html({
title => 'browser compatibility cheat sheet',
version => 'v1.0',
Html({
title => 'browser compatibility cheat sheet',
version => 'v1.0',
- description =>
- "caniuse.",
+ description => [
+ "Compatibility table of new web features (HTML5, CSS3, SVG, Javascript)",
+ "comparing support and usage share for all popular browser versions.",
+ ],
keywords => [qw'
web browser support compatibility usage available feature
html html5 css css3 svg javascript js dom mobile
keywords => [qw'
web browser support compatibility usage available feature
html html5 css css3 svg javascript js dom mobile
@@
-86,8
+88,9
@@
given ($get{usage} // 'wm') {
break;
};
$usage = $_;
break;
};
$usage = $_;
- my $ref = $canihas->{-source} || 'unknown';
- $ref = sprintf '<a href="%s">%s</a>', $_, $ref for $canihas->{-url} || ();
+ my $ref = $canihas->{-title} || 'unknown';
+ $ref = sprintf '<a href="%s">%s</a>', $_, $ref
+ for $canihas->{-site} || $canihas->{-source} || ();
$ref .= " $_" for $canihas->{-date} || ();
print "\nwith $ref browser usage statistics";
}
$ref .= " $_" for $canihas->{-date} || ();
print "\nwith $ref browser usage statistics";
}
@@
-236,10
+239,14
@@
sub saytitlecol {
} $row->{title};
print '<div class=aside>';
s/\.?$/./, print "<p>$_</p>" for map { ref $_ ? @$_ : $_ || () }
} $row->{title};
print '<div class=aside>';
s/\.?$/./, print "<p>$_</p>" for map { ref $_ ? @$_ : $_ || () }
- Entity($row->{description}), formathtml($row->{notes}); # sic
+ Entity($row->{description}),
+ map { s/\s*\n/\n<br>/g; $_ } $row->{notes};
printf 'Resources: %s.', join(', ', map {
sprintf '<a href="%s">%s</a>', EscapeHTML($_->{url}), $_->{title}
} @$_) for grep { @$_ } $row->{links} // ();
printf 'Resources: %s.', join(', ', map {
sprintf '<a href="%s">%s</a>', EscapeHTML($_->{url}), $_->{title}
} @$_) for grep { @$_ } $row->{links} // ();
+ printf '<br>Parent feature: %s.', join(', ', map {
+ sprintf '<a href="%s">%s</a>', EscapeHTML("#$_"), $caniuse->{data}->{$_}->{title}
+ } $_) for $row->{parent} || ();
print '</div>';
}
print '</div>';
}
@@
-261,12
+268,17
@@
sub saybrowsercols {
my ($prev, @span);
for my $ver (@{ $versions{$browser} }, undef) {
my ($prev, @span);
for my $ver (@{ $versions{$browser} }, undef) {
- unless (!defined $prev
- or ref $data eq 'HASH' && $data->{$prev} ~~ $data->{$ver}) {
+ my $compare = (
+ !defined $ver ? undef : # last column if nameless
+ ref $data ne 'HASH' ? 'u' : # unsupported if no support hash
+ $data->{$ver} # known
+ || 'u' # unsure unless oldest is unsupported
+ );
+ unless (!defined $prev or $prev ~~ $compare) {
my $usage = sum(map { $canihas->{$browser}->{$_} } @span);
printf '<td class="%s" colspan="%d" title="%s">%s',
join(' ',
my $usage = sum(map { $canihas->{$browser}->{$_} } @span);
printf '<td class="%s" colspan="%d" title="%s">%s',
join(' ',
- X => $CSTATS{
ref $data eq 'HASH' && $data->{$prev} || 'u'
},
+ X => $CSTATS{
$prev
},
!$usage ? ('p0') : ('p',
sprintf('p%01d', $usage * ($usagepct - .0001) / 10),
sprintf('p%02d', $usage * ($usagepct - .0001)),
!$usage ? ('p0') : ('p',
sprintf('p%01d', $usage * ($usagepct - .0001) / 10),
sprintf('p%02d', $usage * ($usagepct - .0001)),
@@
-278,14
+290,14
@@
sub saybrowsercols {
map { ref $_ eq 'CODE' ? $_->($browser) : $_ }
map { $DSTATS{$_} // () }
map { split / /, $_ }
map { ref $_ eq 'CODE' ? $_->($browser) : $_ }
map { $DSTATS{$_} // () }
map { split / /, $_ }
- ref $data eq 'HASH' && $data->{$prev} || 'u'
+ $prev
)),
showversions(@span),
undef $prev;
@span = ();
}
push @span, $ver;
)),
showversions(@span),
undef $prev;
@span = ();
}
push @span, $ver;
- $prev = $
ver
;
+ $prev = $
compare
;
}
}
}
}
@@
-310,16
+322,6
@@
for my $id (sort {
say '</tbody>';
say '</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)
shift =~ /(?:.*-|^)(\d*)(.*)/;
sub paddedver {
# normalised version number comparable as string (cmp)
shift =~ /(?:.*-|^)(\d*)(.*)/;