aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2012-03-28 18:41:47 -0400
committerJoey Hess <joey@kitenet.net>2012-03-28 18:43:07 -0400
commitd68d25526816d40048ca47ad360304bce162b659 (patch)
tree30230ad338c5e9a4d2574cab844399b2ddf3d075 /IkiWiki
parent1916f974722ff509e44c16b4c07c054ef9a11f96 (diff)
downloadikiwiki-d68d25526816d40048ca47ad360304bce162b659.tar
ikiwiki-d68d25526816d40048ca47ad360304bce162b659.tar.gz
Added a "changes" hook. Renamed the "change" hook to "rendered", but
the old hook name is called for now for back-compat.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/inline.pm2
-rw-r--r--IkiWiki/Plugin/pinger.pm2
-rw-r--r--IkiWiki/Plugin/po.pm4
-rw-r--r--IkiWiki/Plugin/rsync.pm2
-rw-r--r--IkiWiki/Plugin/skeleton.pm.example13
-rw-r--r--IkiWiki/Plugin/transient.pm4
-rw-r--r--IkiWiki/Render.pm7
7 files changed, 23 insertions, 11 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 62910972f..3b49152f4 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -26,7 +26,7 @@ sub import {
# Hook to change to do pinging since it's called late.
# This ensures each page only pings once and prevents slow
# pings interrupting page builds.
- hook(type => "change", id => "inline", call => \&IkiWiki::pingurl);
+ hook(type => "rendered", id => "inline", call => \&IkiWiki::pingurl);
}
sub getopt () {
diff --git a/IkiWiki/Plugin/pinger.pm b/IkiWiki/Plugin/pinger.pm
index ea4f3e0dc..588f7a42a 100644
--- a/IkiWiki/Plugin/pinger.pm
+++ b/IkiWiki/Plugin/pinger.pm
@@ -13,7 +13,7 @@ sub import {
hook(type => "needsbuild", id => "pinger", call => \&needsbuild);
hook(type => "preprocess", id => "ping", call => \&preprocess);
hook(type => "delete", id => "pinger", call => \&ping);
- hook(type => "change", id => "pinger", call => \&ping);
+ hook(type => "rendered", id => "pinger", call => \&ping);
}
sub getsetup () {
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index 287b5aa11..26c6463da 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -47,7 +47,7 @@ sub import {
hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
hook(type => "rename", id => "po", call => \&renamepages, first => 1);
hook(type => "delete", id => "po", call => \&mydelete);
- hook(type => "change", id => "po", call => \&change);
+ hook(type => "rendered", id => "po", call => \&rendered);
hook(type => "checkcontent", id => "po", call => \&checkcontent);
hook(type => "canremove", id => "po", call => \&canremove);
hook(type => "canrename", id => "po", call => \&canrename);
@@ -427,7 +427,7 @@ sub mydelete (@) {
map { deletetranslations($_) } grep istranslatablefile($_), @deleted;
}
-sub change (@) {
+sub rendered (@) {
my @rendered=@_;
my $updated_po_files=0;
diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm
index e38801e4a..1b85ea000 100644
--- a/IkiWiki/Plugin/rsync.pm
+++ b/IkiWiki/Plugin/rsync.pm
@@ -7,7 +7,7 @@ use IkiWiki 3.00;
sub import {
hook(type => "getsetup", id => "rsync", call => \&getsetup);
- hook(type => "change", id => "rsync", call => \&postrefresh);
+ hook(type => "rendered", id => "rsync", call => \&postrefresh);
hook(type => "delete", id => "rsync", call => \&postrefresh);
}
diff --git a/IkiWiki/Plugin/skeleton.pm.example b/IkiWiki/Plugin/skeleton.pm.example
index 7974d5e53..956c52201 100644
--- a/IkiWiki/Plugin/skeleton.pm.example
+++ b/IkiWiki/Plugin/skeleton.pm.example
@@ -26,7 +26,8 @@ sub import {
hook(type => "templatefile", id => "skeleton", call => \&templatefile);
hook(type => "pageactions", id => "skeleton", call => \&pageactions);
hook(type => "delete", id => "skeleton", call => \&delete);
- hook(type => "change", id => "skeleton", call => \&change);
+ hook(type => "rendered", id => "skeleton", call => \&rendered);
+ hook(type => "changes", id => "skeleton", call => \&changes);
hook(type => "cgi", id => "skeleton", call => \&cgi);
hook(type => "auth", id => "skeleton", call => \&auth);
hook(type => "sessioncgi", id => "skeleton", call => \&sessioncgi);
@@ -167,10 +168,16 @@ sub delete (@) {
debug("skeleton plugin told that files were deleted: @files");
}
-sub change (@) {
+sub rendered (@) {
my @files=@_;
- debug("skeleton plugin told that changed files were rendered: @files");
+ debug("skeleton plugin told that files were rendered: @files");
+}
+
+sub changes (@) {
+ my @files=@_;
+
+ debug("skeleton plugin told that files were changed: @files");
}
sub cgi ($) {
diff --git a/IkiWiki/Plugin/transient.pm b/IkiWiki/Plugin/transient.pm
index c0ad5fc11..4ea4317d4 100644
--- a/IkiWiki/Plugin/transient.pm
+++ b/IkiWiki/Plugin/transient.pm
@@ -8,7 +8,7 @@ use IkiWiki 3.00;
sub import {
hook(type => "getsetup", id => "transient", call => \&getsetup);
hook(type => "checkconfig", id => "transient", call => \&checkconfig);
- hook(type => "change", id => "transient", call => \&change);
+ hook(type => "rendered", id => "transient", call => \&rendered);
}
sub getsetup () {
@@ -33,7 +33,7 @@ sub checkconfig () {
}
}
-sub change (@) {
+sub rendered (@) {
foreach my $file (@_) {
# If the corresponding file exists in the transient underlay
# and isn't actually being used, we can get rid of it.
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index adb39a983..98aab8204 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -829,8 +829,13 @@ sub refresh () {
run_hooks(delete => sub { shift->(@$del, @$internal_del) });
}
if (%rendered) {
- run_hooks(change => sub { shift->(keys %rendered) });
+ run_hooks(rendered => sub { shift->(keys %rendered) });
+ run_hooks(change => sub { shift->(keys %rendered) }); # back-compat
}
+ run_hooks(difference => sub {
+ shift->(@$new, @$changed, @$del,
+ @$internal_new, @$internal_changed, @$internal_del);
+ });
}
sub clean_rendered {