]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
Revert "added the tweakbestlink hook"
[ikiwiki.git] / IkiWiki.pm
index 1a55945a83f7ec5d1f1f06da675e1eebbb4ea8f6..ba1847093fce3d5a64aa1ae6508a5726cc6ee5c3 100644 (file)
@@ -411,7 +411,7 @@ sub getsetup () { #{{{
                rebuild => 0,
        },
        allow_symlinks_before_srcdir => {
-               type => "string",
+               type => "boolean",
                default => 0,
                description => "allow symlinks in the path leading to the srcdir (potentially insecure)",
                safe => 0,
@@ -655,8 +655,19 @@ sub newpagefile ($$) { #{{{
 sub targetpage ($$) { #{{{
        my $page=shift;
        my $ext=shift;
-       
-       if (! $config{usedirs} || $page eq 'index') {
+
+       my $targetpage='';
+       run_hooks(targetpage => sub {
+               $targetpage=shift->(
+                       page => $page,
+                       ext => $ext,
+               );
+       });
+
+       if (defined $targetpage && (length($targetpage) > 0)) {
+               return $targetpage;
+       }
+       elsif (! $config{usedirs} || $page eq 'index') {
                return $page.".".$ext;
        }
        else {
@@ -931,6 +942,10 @@ sub beautify_urlpath ($) { #{{{
                $url =~ s!/index.$config{htmlext}$!/!;
        }
 
+       run_hooks(tweakurlpath => sub {
+               $url=shift->(url => $url);
+       });
+
        # Ensure url is not an empty link, and
        # if it's relative, make that explicit to avoid colon confusion.
        if ($url !~ /^\//) {