git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
common: early setup of plp error formatting
[sheet.git]
/
browser.plp
diff --git
a/browser.plp
b/browser.plp
index bdde90e3401d86467859776b2a090efce443790b..de245b8159a8af06e56b140ccfe0dab3d24cbc38 100644
(file)
--- a/
browser.plp
+++ b/
browser.plp
@@
-90,22
+90,24
@@
print <<'';
<p id="intro">Alternate rendition of Fyrd's <a href="http://caniuse.com/">when can I use...</a> page
my ($canihas, $usage);
<p id="intro">Alternate rendition of Fyrd's <a href="http://caniuse.com/">when can I use...</a> page
my ($canihas, $usage);
-my $minusage = $get{threshold} //
.7
;
+my $minusage = $get{threshold} //
1
;
given ($get{usage} // 'wm') {
when (!$_) {
# none
}
when (!m{ \A [a-z]\w+ (?:/\d[\d-]*\d)? \z }x) {
given ($get{usage} // 'wm') {
when (!$_) {
# none
}
when (!m{ \A [a-z]\w+ (?:/\d[\d-]*\d)? \z }x) {
- printf "<p>Invalid browser usage data request: <em>%s</em>",
- 'identifier must be alphanumeric name or <q>0</q>';
+ Alert([
+ 'Invalid browser usage data request',
+ 'Identifier must be alphanumeric name or <q>0</q>.',
+ ]);
}
$canihas = do "data/browser/usage-$_.inc.pl" or do {
}
$canihas = do "data/browser/usage-$_.inc.pl" or do {
-
printf "<p>Browser usage data not found: <em>%s</em>", $@ || $!
;
+
Alert('Browser usage data not found', $@ || $!)
;
break;
};
$usage = $_;
my $ref = $canihas->{-title} || 'unknown';
break;
};
$usage = $_;
my $ref = $canihas->{-title} || 'unknown';
- $ref = s
printf '<a href="%s">%s</a>', $_, $ref
+ $ref = s
howlink($ref, $_)
for $canihas->{-site} || $canihas->{-source} || ();
$ref .= " $_" for $canihas->{-date} || ();
print "\nwith $ref browser usage statistics";
for $canihas->{-site} || $canihas->{-source} || ();
$ref .= " $_" for $canihas->{-date} || ();
print "\nwith $ref browser usage statistics";
@@
-309,6
+311,15
@@
sub formatnotes {
return @html;
}
return @html;
}
+sub notestotitle {
+ my @notes = @_;
+ for (@notes) {
+ EscapeHTML($_);
+ s{ \[ ([^]]*) \] \( [^)]* \) }{$1}gx; # strip link urls
+ }
+ return @notes;
+}
+
sub saytitlecol {
my ($id) = @_;
my $row = $caniuse->{data}->{$id};
sub saytitlecol {
my ($id) = @_;
my $row = $caniuse->{data}->{$id};
@@
-337,10
+348,10
@@
sub saytitlecol {
say '</p>';
}
printf 'Resources: %s.', join(', ', map {
say '</p>';
}
printf 'Resources: %s.', join(', ', map {
- s
printf '<a href="%s">%s</a>', EscapeHTML($_->{url}), EscapeHTML($_->{title
})
+ s
howlink($_->{title}, $_->{url
})
} @$_) for grep { @$_ } $row->{links} // ();
printf '<br>Parent feature: %s.', join(', ', map {
} @$_) for grep { @$_ } $row->{links} // ();
printf '<br>Parent feature: %s.', join(', ', map {
- s
printf '<a href="%s">%s</a>', EscapeHTML("#$_"), $caniuse->{data}->{$_}->{title}
+ s
howlink($caniuse->{data}->{$_}->{title}, "#$_")
} $_) for $row->{parent} || ();
print '</div>';
}
} $_) for $row->{parent} || ();
print '</div>';
}
@@
-351,7
+362,7
@@
sub saystatuscol {
for ($row->{status}) {
my $cell = $_ // '-';
for ($row->{status}) {
my $cell = $_ // '-';
- $cell = s
printf '<a href="%s">%s</a>', $_, $cell
for $row->{spec} // ();
+ $cell = s
howlink($cell, $_)
for $row->{spec} // ();
printf '<td title="%s" class="l %s">%s',
$caniuse->{statuses}->{$_}, $CSTATUS{$_} // '', $cell;
}
printf '<td title="%s" class="l %s">%s',
$caniuse->{statuses}->{$_}, $CSTATUS{$_} // '', $cell;
}
@@
-394,7
+405,7
@@
sub saybrowsercols {
map { split / /, $_ }
$prev
));
map { split / /, $_ }
$prev
));
- $title .= "\n
".EscapeHTML($_) for @notes
;
+ $title .= "\n
$_" for notestotitle(@notes)
;
printf('<td class="%s" colspan="%d" title="%s">%s',
join(' ',
printf('<td class="%s" colspan="%d" title="%s">%s',
join(' ',