summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2009-01-27 00:00:00 +0100
committerintrigeri <intrigeri@boum.org>2009-01-27 00:00:00 +0100
commit03ab2623194009bf3cb82747c59dbf565b89e7bf (patch)
treec562ebaad239164b566d9ff7aa127db69a2cfa8d
parent8915d2553c056304bef2fd77b8fc03d99a49e2a9 (diff)
revert renamepage's hook original name
Signed-off-by: intrigeri <intrigeri@boum.org>
-rw-r--r--IkiWiki/Plugin/link.pm4
-rw-r--r--IkiWiki/Plugin/rename.pm8
-rw-r--r--IkiWiki/Plugin/skeleton.pm.example14
-rw-r--r--doc/plugins/write.mdwn4
-rwxr-xr-xt/renamepage.t4
5 files changed, 24 insertions, 10 deletions
diff --git a/IkiWiki/Plugin/link.pm b/IkiWiki/Plugin/link.pm
index 48691d973..b79273f96 100644
--- a/IkiWiki/Plugin/link.pm
+++ b/IkiWiki/Plugin/link.pm
@@ -12,7 +12,7 @@ sub import {
hook(type => "checkconfig", id => "link", call => \&checkconfig);
hook(type => "linkify", id => "link", call => \&linkify);
hook(type => "scan", id => "link", call => \&scan);
- hook(type => "renamelink", id => "link", call => \&renamelink);
+ hook(type => "renamepage", id => "link", call => \&renamepage);
}
sub getsetup () {
@@ -90,7 +90,7 @@ sub scan (@) {
}
}
-sub renamelink (@) {
+sub renamepage (@) {
my %params=@_;
my $page=$params{page};
my $old=$params{oldpage};
diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm
index b43c5282a..90af1b4a9 100644
--- a/IkiWiki/Plugin/rename.pm
+++ b/IkiWiki/Plugin/rename.pm
@@ -216,7 +216,7 @@ sub postrename ($;$$$) {
# Update edit form content to fix any links present
# on it.
$postrename->param("editcontent",
- renamelink_hook($dest, $src, $dest,
+ renamepage_hook($dest, $src, $dest,
$postrename->param("editcontent")));
# Get a new edit token; old was likely invalidated.
@@ -446,10 +446,10 @@ sub linklist {
} @{$list}]
}
-sub renamelink_hook ($$$$) {
+sub renamepage_hook ($$$$) {
my ($page, $src, $dest, $content)=@_;
- IkiWiki::run_hooks(renamelink => sub {
+ IkiWiki::run_hooks(renamepage => sub {
$content=shift->(
page => $page,
oldpage => $src,
@@ -506,7 +506,7 @@ sub fixlinks ($$$) {
if ($needfix) {
my $file=$pagesources{$page};
my $oldcontent=readfile($config{srcdir}."/".$file);
- my $content=renamelink_hook($page, $rename->{src}, $rename->{dest}, $oldcontent);
+ my $content=renamepage_hook($page, $rename->{src}, $rename->{dest}, $oldcontent);
if ($oldcontent ne $content) {
my $token=IkiWiki::rcs_prepedit($file);
eval { writefile($file, $config{srcdir}, $content) };
diff --git a/IkiWiki/Plugin/skeleton.pm.example b/IkiWiki/Plugin/skeleton.pm.example
index 6a97fb2f2..5fb391b0d 100644
--- a/IkiWiki/Plugin/skeleton.pm.example
+++ b/IkiWiki/Plugin/skeleton.pm.example
@@ -36,6 +36,8 @@ sub import {
hook(type => "editcontent", id => "skeleton", call => \&editcontent);
hook(type => "formbuilder_setup", id => "skeleton", call => \&formbuilder_setup);
hook(type => "formbuilder", id => "skeleton", call => \&formbuilder);
+ hook(type => "renamepage", id => "skeleton", call => \&renamepage);
+ hook(type => "rename", id => "skeleton", call => \&renamepages);
hook(type => "savestate", id => "skeleton", call => \&savestate);
}
@@ -221,6 +223,18 @@ sub formbuilder (@) {
debug("skeleton plugin running in formbuilder");
}
+sub renamepage (@) {
+ my %params=@_;
+
+ debug("skeleton plugin running in renamepage");
+}
+
+sub renamepages ($$$) {
+ my ($torename, $cgi, $session) = (shift, shift, shift);
+
+ debug("skeleton plugin running in rename");
+}
+
sub savestate () {
debug("skeleton plugin running in savestate");
}
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index dde0d431c..98372b33d 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -401,9 +401,9 @@ This hook is called whenever ikiwiki normally saves its state, just before
the state is saved. The function can save other state, modify values before
they're saved, etc.
-### renamelink
+### renamepage
- hook(type => "renamelink", id => "foo", call => \&renamelink);
+ hook(type => "renamepage", id => "foo", call => \&renamepage);
This hook is called by the [[plugins/rename]] plugin when it renames
something, once per page linking to the renamed page's old location.
diff --git a/t/renamepage.t b/t/renamepage.t
index 0aa3a1c9f..a706cbb46 100755
--- a/t/renamepage.t
+++ b/t/renamepage.t
@@ -11,7 +11,7 @@ BEGIN { use_ok("IkiWiki::Plugin::link"); }
$config{srcdir}=$config{destdir}="/dev/null";
IkiWiki::checkconfig();
-# tests of the link plugin's renamelink function
+# tests of the link plugin's renamepage function
sub try {
my ($page, $oldpage, $newpage, $content)=@_;
@@ -23,7 +23,7 @@ sub try {
$links{$page}=[];
}
- IkiWiki::Plugin::link::renamelink(
+ IkiWiki::Plugin::link::renamepage(
page => $page,
oldpage => $oldpage,
newpage => $newpage,