revert renamepage's hook original name

Signed-off-by: intrigeri <intrigeri@boum.org>
master
intrigeri 2009-01-27 00:00:00 +01:00
parent 8915d2553c
commit 03ab262319
5 changed files with 24 additions and 10 deletions

View 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};

View 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) };

View 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");
}

View 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.

View File

@ -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,