X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/e674bb1445378ce43ae60720e42d6c418270001a..055dfa00c6bf16af237731426caf2cdfa0bdcb90:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index fa49b2c34..cfa4f5f03 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -911,7 +911,7 @@ sub will_render ($$;$) { if (-d _) { foreach my $p (keys %renderedfiles, keys %oldrenderedfiles) { foreach my $f (@{$renderedfiles{$p}}, @{$oldrenderedfiles{$p}}) { - if ($f eq dirname($dest) || dirname($f) eq $dest) { + if (dirname($f) eq $dest) { unlink("$config{destdir}/$f"); rmdir(dirname("$config{destdir}/$f")); } @@ -1118,6 +1118,15 @@ sub urlto ($$;$) { return beautify_urlpath($link); } +sub isselflink ($$) { + # Plugins can override this function to support special types + # of selflinks. + my $page=shift; + my $link=shift; + + return $page eq $link; +} + sub htmllink ($$$;@) { my $lpage=shift; # the page doing the linking my $page=shift; # the page that will contain the link (different for inline) @@ -1143,7 +1152,7 @@ sub htmllink ($$$;@) { } return "$linktext" - if length $bestlink && $page eq $bestlink && + if length $bestlink && isselflink($page, $bestlink) && ! defined $opts{anchor}; if (! $destsources{$bestlink}) { @@ -1721,12 +1730,15 @@ sub template_file ($) { my $name=shift; my $tpage=($name =~ s/^\///) ? $name : "templates/$name"; + my $template; if ($name !~ /\.tmpl$/ && exists $pagesources{$tpage}) { - $tpage=$pagesources{$tpage}; + $template=srcfile($pagesources{$tpage}, 1); $name.=".tmpl"; } + else { + $template=srcfile($tpage, 1); + } - my $template=srcfile($tpage, 1); if (defined $template) { return $template, $tpage, 1 if wantarray; return $template;