X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/05124f9a86dadca50c693d57f8fc8398fb5d8be9..f910c81b89fe8cf99cb5eabfaec4bd47eb78c61a:/IkiWiki.pm?ds=sidebyside diff --git a/IkiWiki.pm b/IkiWiki.pm index 0b420e824..a4657a311 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -538,15 +538,21 @@ sub beautify_url ($) { #{{{ if ($config{usedirs}) { $url =~ s!/index.$config{htmlext}$!/!; } - $url =~ s!^$!./!; # Browsers don't like empty links... + + # Ensure url is not an empty link, and + # if it's relative, make that explicit to avoid colon confusion. + if ($url !~ /^\//) { + $url="./$url"; + } return $url; } #}}} -sub urlto ($$) { #{{{ +sub urlto ($$;$) { #{{{ my $to=shift; my $from=shift; - + my $absolute=shift; + if (! length $to) { return beautify_url(baseurl($from)."index.$config{htmlext}"); } @@ -555,6 +561,10 @@ sub urlto ($$) { #{{{ $to=htmlpage($to); } + if ($absolute) { + return $config{url}.beautify_urlpath("/".$to); + } + my $link = abs2rel($to, dirname(htmlpage($from))); return beautify_url($link); @@ -713,7 +723,9 @@ sub preprocess ($$$;$$) { #{{{ my $prefix=shift; my $command=shift; my $params=shift; - if (length $escape) { + $params="" if ! defined $params; + + f (length $escape) { return "[[$prefix$command $params]]"; } elsif (exists $hooks{preprocess}{$command}) {