X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/246db0f234f16f57d28a8639be36f7e5dfc598ad..b74b7ab68b983b3f7d9e561eb991b21764cdb3be:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index 063cef8e0..01e7cc1e4 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -538,17 +538,18 @@ sub beautify_urlpath ($) { #{{{ # 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}"); } @@ -557,6 +558,10 @@ sub urlto ($$) { #{{{ $to=htmlpage($to); } + if ($absolute) { + return $config{url}.beautify_urlpath("/".$to); + } + my $link = abs2rel($to, dirname(htmlpage($from))); return beautify_urlpath($link);