diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-01-09 02:30:46 -0500 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-01-09 02:30:46 -0500 |
commit | 50faf0b151e08887b686e88d525b3b3e3b5379e5 (patch) | |
tree | 9f288c35bd6fb54c0d7cca1a41f95fdd3827f438 /IkiWiki.pm | |
parent | 65db156614d7d5dffaeb16f338c5702c4d5945df (diff) | |
download | ikiwiki-50faf0b151e08887b686e88d525b3b3e3b5379e5.tar ikiwiki-50faf0b151e08887b686e88d525b3b3e3b5379e5.tar.gz |
Call preprocessor hooks in void context during the scan pass.
This allows the hook to determine if it's just scanning, and avoid expensive
operations.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index b0ac8bbb4..d001760a2 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -723,12 +723,25 @@ sub preprocess ($$$;$$) { #{{{ $command, $page, $preprocessing{$page}). "]]"; } - my $ret=$hooks{preprocess}{$command}{call}->( - @params, - page => $page, - destpage => $destpage, - preview => $preprocess_preview, - ); + my $ret; + if (! $scan) { + $ret=$hooks{preprocess}{$command}{call}->( + @params, + page => $page, + destpage => $destpage, + preview => $preprocess_preview, + ); + } + else { + # use void context during scan pass + $hooks{preprocess}{$command}{call}->( + @params, + page => $page, + destpage => $destpage, + preview => $preprocess_preview, + ); + $ret=""; + } $preprocessing{$page}--; return $ret; } |