diff options
-rw-r--r-- | IkiWiki/Plugin/blogspam.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Plugin/editpage.pm | 2 | ||||
-rw-r--r-- | doc/plugins/write.mdwn | 5 |
3 files changed, 5 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm index cc6e840f0..d4b5b36d5 100644 --- a/IkiWiki/Plugin/blogspam.pm +++ b/IkiWiki/Plugin/blogspam.pm @@ -85,7 +85,7 @@ sub checkcontent (@) { my $res = $client->send_request('testComment', { ip => $ENV{REMOTE_ADDR}, - comment => $params{content}, + comment => defined $params{diff} ? $params{diff} : $params{content}, subject => defined $params{subject} ? $params{subject} : "", name => defined $params{author} ? $params{author} : "", link => exists $params{url} ? $params{url} : "", diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 658d664af..4540b55d0 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -93,7 +93,7 @@ sub check_content (@) { foreach my $line (split("\n", $params{content})) { push @diff, $line if ! exists $old{$_}; } - $params{content}=join("\n", @diff); + $params{diff}=join("\n", @diff); } my $ok; diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index ef14f18db..7ba01ae53 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -368,8 +368,9 @@ the content the user has entered is a comment, it may also be passed some additional parameters: `author`, `url`, and `subject`. The `subject` parameter may also be filled with the user's comment about the change. -Note: When the user edits an existing wiki page, the passed `content` will -include only the lines that they added to the page, or modified. +Note: When the user edits an existing wiki page, this hook is also +passed a `diff` named parameter, which will include only the lines +that they added to the page, or modified. The hook should return `undef` on success. If the content is disallowed, it should return a message stating what the problem is, or a function |