X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/edb59cd5b949de7a68f3b74e7949bf3893b23c6a..490d2c65986abf7359d230d96e74276116083515:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index 80e317110..3f8a4bca3 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -77,7 +77,8 @@ sub defaultconfig () { #{{{ adminuser => undef, adminemail => undef, plugin => [qw{mdwn link inline htmlscrubber passwordauth openid - signinedit lockedit conditional recentchanges}], + signinedit lockedit conditional recentchanges + parentlinks}], libdir => undef, timeformat => '%c', locale => undef, @@ -537,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}"); } @@ -556,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); @@ -758,13 +764,10 @@ sub preprocess ($$$;$$) { #{{{ 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 ". + sprintf(gettext("preprocessing loop detected on %s at depth %i"), + $page, $preprocessing{$page}). + "]]"; } my $ret; if (! $scan) { @@ -825,7 +828,8 @@ sub preprocess ($$$;$$) { #{{{ *)? # 0 or more parameters \]\] # directive closed }sx; - } else { + } + else { $regex = qr{ (\\?) # 1: escape? \[\[(!?) # directive open; 2: optional prefix