summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/rename.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-10-01 15:54:10 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-10-01 15:54:10 -0400
commit18b1c7f01256ec7761263fb699aa51ae9d92bc0b (patch)
tree9e6469c756481006545152a93cffde8eec5b186b /IkiWiki/Plugin/rename.pm
parentaba53047af2cb06436ddac156bc6bb3e016b96b3 (diff)
parent826af4600a4e413ca8ec7b6d56f0a1cdca0ad635 (diff)
Merge branch 'tova'
Diffstat (limited to 'IkiWiki/Plugin/rename.pm')
-rw-r--r--IkiWiki/Plugin/rename.pm28
1 files changed, 16 insertions, 12 deletions
diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm
index 3ee457ff0..6c131487a 100644
--- a/IkiWiki/Plugin/rename.pm
+++ b/IkiWiki/Plugin/rename.pm
@@ -279,7 +279,7 @@ sub sessioncgi ($$) { #{{{
$type=$ext;
}
- $destfile.=".".$type;
+ $destfile=newpagefile($dest, $type);
}
push @torename, {
src => $src,
@@ -292,17 +292,21 @@ sub sessioncgi ($$) { #{{{
# See if any subpages need to be renamed.
if ($q->param("subpages") && $src ne $dest) {
foreach my $p (keys %pagesources) {
- if ($pagesources{$p}=~m/^\Q$src\E\//) {
- my $d=$pagesources{$p};
- $d=~s/^\Q$src\E\//$dest\//;
- push @torename, {
- src => $p,
- srcfile => $pagesources{$p},
- dest => pagename($d),
- destfile => $d,
- required => 0,
- };
- }
+ next unless $pagesources{$p}=~m/^\Q$src\E\//;
+ # If indexpages is enabled, the
+ # srcfile should not be confused
+ # with a subpage.
+ next if $pagesources{$p} eq $srcfile;
+
+ my $d=$pagesources{$p};
+ $d=~s/^\Q$src\E\//$dest\//;
+ push @torename, {
+ src => $p,
+ srcfile => $pagesources{$p},
+ dest => pagename($d),
+ destfile => $d,
+ required => 0,
+ };
}
}