};
$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";
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;
}
}
my $scriptname = do 'writing-script.inc.pl';
-$_ = qq{<a href="/latin">$_</a>} for $scriptname->{latn} || ();
+$_ = showlink($_, "/latin") for $scriptname->{latn} || ();
my $table = do "writing-digits.inc.pl";
die "Table data not found: $_\n" for $@ || $! || ();
my $meta = shift @info or die $@;
ref $meta eq 'HASH' or die "invalid $system definitions";
my $title = $meta->{name} // $system;
- $title = qq{<a href="$_">$title</a>} for $meta->{source} || ();
+ $title = showlink($title, $_) for $meta->{source} || ();
say sprintf '<div class="section"><h2>%s</h2>', $meta->{name} // $system;
say '<table><tbody>';
say "<p>Unit properties as seen or measured in $scver{name}\n$patch.";
say "Also see the $_ table." for join(', ',
- ('<a href="/sc/2">StarCraft 2: HotS</a>') x ($scver{major} < 2),
- ('<a href="/sc">original SC: Brood War</a>') x ($scver{major} > 1),
+ (showlink('StarCraft 2: HotS', '/sc/2')) x ($scver{major} < 2),
+ (showlink('original SC: Brood War', '/sc')) x ($scver{major} > 1),
);
say "</p>\n";
sub coltoggle {
my ($name, $id, $nolink) = @_;
- return sprintf(
- (defined $get{order} ? $get{order} eq $id : !$id) ? '%2$s ▼'
- : $nolink ? '%2$s' : '<a href="?%s">%s</a>',
- $id && "order=$id", $name
- );
+ return "$name ▼" if defined $get{order} ? $get{order} eq $id : !$id;
+ return $name if $nolink;
+ return showlink($name, '?'.($id && "order=$id"));
}
:><table class="units">
<thead><tr>
say '<ul>';
for (glob '*.plp') {
chomp;
- say sprintf '<li><a href="/source/%s">%1$s</a></li>', EscapeHTML($_);
+ say '<li>', showlink($_, "/source/$_");
}
say "</ul>\n";
}
if (!$type || $type eq 'Constant'
and $contents =~ s{^(['"]?)(/?[a-z0-9_.]+\.(?:plp?|css|js))(?=\1$)}{}) {
# link other page sources, stylesheets, and javascript
- printf '%s<a href="%s">%s</a>', $1, "/source/$2", $2;
+ print $1 . showlink($2, "/source/$2");
}
if (!$type and $contents =~ s/^(\s*)([A-Z]\w+(?:::\w+)+)(?![^;\s])//) {
# link perl module names (Xx::Xx...)
- printf '%s<a href="%s">%s</a>', $1, "/source/$2", $2;
+ print $1 . showlink($2, "/source/$2");
}
if ($type && $type eq 'Comment'
and $contents =~ s{^(.*? by )(tools/\S+)}{}) {
# link generator scripts (by tools/...)
- printf '%s<a href="%s">%s</a>', $1, "/source/$2", $2;
+ print $1 . showlink($2, "/source/$2");
}
print Text::VimColor::_xml_escape($contents);
print "</$tag>" if $tag;
}
my $scriptname = do 'writing-script.inc.pl';
-$_ = qq{<a href="/latin">$_</a>} for $scriptname->{latn} || ();
+$_ = showlink($_, "/latin") for $scriptname->{latn} || ();
for (
[phnx => 'Phoenician'],