X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/7237fc7f2e96557e06caf48f97db9b041ffa870b..9643ce20d8988da38f192689468075fe44709703:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index bab7b707a..ba1847093 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -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 !~ /^\//) {