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
parent
65db156614
commit
50faf0b151
25
IkiWiki.pm
25
IkiWiki.pm
|
@ -723,12 +723,25 @@ sub preprocess ($$$;$$) { #{{{
|
||||||
$command, $page, $preprocessing{$page}).
|
$command, $page, $preprocessing{$page}).
|
||||||
"]]";
|
"]]";
|
||||||
}
|
}
|
||||||
my $ret=$hooks{preprocess}{$command}{call}->(
|
my $ret;
|
||||||
@params,
|
if (! $scan) {
|
||||||
page => $page,
|
$ret=$hooks{preprocess}{$command}{call}->(
|
||||||
destpage => $destpage,
|
@params,
|
||||||
preview => $preprocess_preview,
|
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}--;
|
$preprocessing{$page}--;
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue