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 () {
}
}
-sub renamelink (@) {
+sub renamepage (@) {
my %params=@_;
my $page=$params{page};
my $old=$params{oldpage};
# 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.
} @{$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,
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) };
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);
}
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");
}
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.
$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)=@_;
$links{$page}=[];
}
- IkiWiki::Plugin::link::renamelink(
+ IkiWiki::Plugin::link::renamepage(
page => $page,
oldpage => $oldpage,
newpage => $newpage,