X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=IkiWiki.pm;h=01e7cc1e4c1febee4d84209c281e84a78deb7198;hb=e727d5b6e91088b0c4720f31ecafa76669979a19;hp=6a1823c5a940461ab8cf8ad5952a889323713bbf;hpb=2c05a34be17c805d929f0ad563acf857eba1d46b;p=ikiwiki.git diff --git a/IkiWiki.pm b/IkiWiki.pm index 6a1823c5a..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); @@ -826,7 +831,8 @@ sub preprocess ($$$;$$) { #{{{ *)? # 0 or more parameters \]\] # directive closed }sx; - } else { + } + else { $regex = qr{ (\\?) # 1: escape? \[\[(!?) # directive open; 2: optional prefix