<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
};
$usage = $_;
my $ref = $canihas->{-title} || 'unknown';
- $ref = sprintf '<a href="%s">%s</a>', $_, $ref
+ $ref = showlink($ref, $_)
for $canihas->{-site} || $canihas->{-source} || ();
$ref .= " $_" for $canihas->{-date} || ();
print "\nwith $ref browser usage statistics";
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};
say '</p>';
}
printf 'Resources: %s.', join(', ', map {
- sprintf '<a href="%s">%s</a>', EscapeHTML($_->{url}), EscapeHTML($_->{title})
+ showlink($_->{title}, $_->{url})
} @$_) for grep { @$_ } $row->{links} // ();
printf '<br>Parent feature: %s.', join(', ', map {
- sprintf '<a href="%s">%s</a>', EscapeHTML("#$_"), $caniuse->{data}->{$_}->{title}
+ showlink($caniuse->{data}->{$_}->{title}, "#$_")
} $_) for $row->{parent} || ();
print '</div>';
}
for ($row->{status}) {
my $cell = $_ // '-';
- $cell = sprintf '<a href="%s">%s</a>', $_, $cell for $row->{spec} // ();
+ $cell = showlink($cell, $_) for $row->{spec} // ();
printf '<td title="%s" class="l %s">%s',
$caniuse->{statuses}->{$_}, $CSTATUS{$_} // '', $cell;
}
map { split / /, $_ }
$prev
));
- $title .= "\n".EscapeHTML($_) for @notes;
+ $title .= "\n$_" for notestotitle(@notes);
printf('<td class="%s" colspan="%d" title="%s">%s',
join(' ',