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.
master
Joey Hess 2008-01-09 02:30:46 -05:00
parent 65db156614
commit 50faf0b151
1 changed files with 19 additions and 6 deletions

View File

@ -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;
}