]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki.pm
inline: Ignore parent dirs when sorting pages by title.
[git.ikiwiki.info.git] / IkiWiki.pm
index e0793b5faa4c362a112cb86e9d6abd06544240b3..a4657a311e36c37b22daddc6ee88e4416526ca12 100644 (file)
@@ -541,17 +541,18 @@ sub beautify_url ($) { #{{{
 
        # 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_url(baseurl($from)."index.$config{htmlext}");
        }
@@ -560,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);
@@ -718,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}) {
@@ -844,8 +851,7 @@ sub preprocess ($$$;$$) { #{{{
                }sx;
        }
 
-       # $4 can be undef if the directive was [[!foo]]
-       $content =~ s{$regex}{$handle->($1, $2, $3, ($4 or ""))}eg;
+       $content =~ s{$regex}{$handle->($1, $2, $3, $4)}eg;
        return $content;
 } #}}}