]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
Revert "added hook urlpath" and "rename urlpath hook into tweakurlpath..."
[ikiwiki.git] / IkiWiki.pm
index 90fedca4f5dfb5614c229be58f453ea83307ea28..8b3a911143934b0fe6acf674edf6b18e2bbc84d1 100644 (file)
@@ -815,7 +815,6 @@ sub will_render ($$;$) { #{{{
 sub bestlink ($$) { #{{{
        my $page=shift;
        my $link=shift;
-       my $res=undef;
        
        my $cwd=$page;
        if ($link=~s/^\/+//) {
@@ -830,35 +829,25 @@ sub bestlink ($$) { #{{{
                $l.=$link;
 
                if (exists $links{$l}) {
-                       $res=$l;
+                       return $l;
                }
                elsif (exists $pagecase{lc $l}) {
-                       $res=$pagecase{lc $l};
+                       return $pagecase{lc $l};
                }
-       } while ($cwd=~s{/?[^/]+$}{} && ! defined $res);
+       } while $cwd=~s{/?[^/]+$}{};
 
-       if (! defined $res && length $config{userdir}) {
+       if (length $config{userdir}) {
                my $l = "$config{userdir}/".lc($link);
                if (exists $links{$l}) {
-                       $res=$l;
+                       return $l;
                }
                elsif (exists $pagecase{lc $l}) {
-                       $res=$pagecase{lc $l};
+                       return $pagecase{lc $l};
                }
        }
 
-       if (defined $res) {
-               run_hooks(tweakbestlink => sub {
-                       $res=shift->(
-                               page => $page,
-                               link => $res);
-               });
-               return $res;
-       }
-       else {
-               #print STDERR "warning: page $page, broken link: $link\n";
-               return "";
-       }
+       #print STDERR "warning: page $page, broken link: $link\n";
+       return "";
 } #}}}
 
 sub isinlinableimage ($) { #{{{
@@ -953,10 +942,6 @@ 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 !~ /^\//) {