aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-06-29 17:55:53 -0400
committerJoey Hess <joey@kitenet.net>2011-06-29 17:55:53 -0400
commit6d01db205f41f16755fe7fbe49694b3bba2121c8 (patch)
tree313795259bce36c151d1e512728c6552b061d3b0 /IkiWiki
parent7b57bb843f2fe8b7901f7b9b10c95597527d4093 (diff)
parent94268a46cd30fc72b51714e42e9db741eb29cc73 (diff)
downloadikiwiki-6d01db205f41f16755fe7fbe49694b3bba2121c8.tar
ikiwiki-6d01db205f41f16755fe7fbe49694b3bba2121c8.tar.gz
Merge remote-tracking branch 'smcv/comments-metadata'
Diffstat (limited to 'IkiWiki')
-rwxr-xr-xIkiWiki/Plugin/comments.pm36
-rw-r--r--IkiWiki/Render.pm12
2 files changed, 32 insertions, 16 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 9fb81d15a..3ad2a0e13 100755
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -21,7 +21,8 @@ my %commentstate;
sub import {
hook(type => "checkconfig", id => 'comments', call => \&checkconfig);
hook(type => "getsetup", id => 'comments', call => \&getsetup);
- hook(type => "preprocess", id => 'comment', call => \&preprocess);
+ hook(type => "preprocess", id => 'comment', call => \&preprocess,
+ scan => 1);
hook(type => "preprocess", id => 'commentmoderation', call => \&preprocess_moderation);
# here for backwards compatability with old comments
hook(type => "preprocess", id => '_comment', call => \&preprocess);
@@ -143,22 +144,27 @@ sub preprocess {
}
$content =~ s/\\"/"/g;
- if ($config{comments_allowdirectives}) {
- $content = IkiWiki::preprocess($page, $params{destpage},
- $content);
- }
+ if (defined wantarray) {
+ if ($config{comments_allowdirectives}) {
+ $content = IkiWiki::preprocess($page, $params{destpage},
+ $content);
+ }
- # no need to bother with htmlize if it's just HTML
- $content = IkiWiki::htmlize($page, $params{destpage}, $format, $content)
- if defined $format;
+ # no need to bother with htmlize if it's just HTML
+ $content = IkiWiki::htmlize($page, $params{destpage}, $format, $content)
+ if defined $format;
- IkiWiki::run_hooks(sanitize => sub {
- $content = shift->(
- page => $page,
- destpage => $params{destpage},
- content => $content,
- );
- });
+ IkiWiki::run_hooks(sanitize => sub {
+ $content = shift->(
+ page => $page,
+ destpage => $params{destpage},
+ content => $content,
+ );
+ });
+ }
+ else {
+ IkiWiki::preprocess($page, $params{destpage}, $content, 1);
+ }
# set metadata, possibly overriding [[!meta]] directives from the
# comment itself
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 5288abc6d..05132a8a8 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -475,8 +475,18 @@ sub find_changed ($) {
$pagemtime{$page}=$stat[9];
if (isinternal($page)) {
+ my $content = readfile($srcfile);
+
# Preprocess internal page in scan-only mode.
- preprocess($page, $page, readfile($srcfile), 1);
+ preprocess($page, $page, $content, 1);
+
+ run_hooks(scan => sub {
+ shift->(
+ page => $page,
+ content => $content,
+ );
+ });
+
push @internal_changed, $file;
}
else {