revert renamepage's hook original name
authorintrigeri <intrigeri@boum.org>
Mon, 26 Jan 2009 23:00:00 +0000 (00:00 +0100)
committerintrigeri <intrigeri@boum.org>
Mon, 26 Jan 2009 23:00:00 +0000 (00:00 +0100)
Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/link.pm
IkiWiki/Plugin/rename.pm
IkiWiki/Plugin/skeleton.pm.example
doc/plugins/write.mdwn
t/renamepage.t

index 48691d97363881d2a70e210364e8fd76abb2eede..b79273f96240dcfc0a66308bb3a942f6198945f0 100644 (file)
@@ -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};
index b43c5282ab0dd841da52017c1a456fc573c052a3..90af1b4a985e5f94bd724ac88064ccf53d7d4919 100644 (file)
@@ -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) };
index 6a97fb2f2b7cf4ade487f853886d720272a8bcb0..5fb391b0ddf2768b076c06c9a7aca9b2e0d58c5c 100644 (file)
@@ -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");
 }
index dde0d431c3f1ed4d6ca813c45480ef2f25807584..98372b33de3fb14857fc97c5a212ed000f0eac55 100644 (file)
@@ -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.
index 0aa3a1c9fda8b127446516490429de1b2c01f164..a706cbb46a15466c0adf9e579a0aeabf12f01ec6 100755 (executable)
@@ -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,