# Ensure url is not an empty link, and
# if it's relative, make that explicit to avoid colon confusion.
- if ($url !~ /\//) {
+ if ($url !~ /^\//) {
$url="./$url";
}
return $url;
} #}}}
-sub urlto ($$) { #{{{
+sub urlto ($$;$) { #{{{
my $to=shift;
my $from=shift;
-
+ my $absolute=shift;
+
if (! length $to) {
return beautify_urlpath(baseurl($from)."index.$config{htmlext}");
}
$to=htmlpage($to);
}
+ if ($absolute) {
+ return $config{url}.beautify_urlpath("/".$to);
+ }
+
my $link = abs2rel($to, dirname(htmlpage($from)));
return beautify_urlpath($link);
if ($preprocessing{$page}++ > 3) {
# Avoid loops of preprocessed pages preprocessing
# other pages that preprocess them, etc.
- #translators: The first parameter is a
- #translators: preprocessor directive name,
- #translators: the second a page name, the
- #translators: third a number.
- return "[[".sprintf(gettext("%s preprocessing loop detected on %s at depth %i"),
- $command, $page, $preprocessing{$page}).
- "]]";
+ return "[[!$command <span class=\"error\">".
+ sprintf(gettext("preprocessing loop detected on %s at depth %i"),
+ $page, $preprocessing{$page}).
+ "</span>]]";
}
my $ret;
if (! $scan) {
*)? # 0 or more parameters
\]\] # directive closed
}sx;
- } else {
+ }
+ else {
$regex = qr{
(\\?) # 1: escape?
\[\[(!?) # directive open; 2: optional prefix