aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-10-28 05:07:56 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-10-28 05:07:56 +0000
commitdb3b72c4822cf9057460d47654c35f0a5115139e (patch)
tree723244c830c22679398ee87bba7a2dbc5f5d8264 /IkiWiki.pm
parent49bf877701d89d613dcf5c2d85bd08876a636dba (diff)
downloadikiwiki-db3b72c4822cf9057460d47654c35f0a5115139e.tar
ikiwiki-db3b72c4822cf9057460d47654c35f0a5115139e.tar.gz
instead of over and over. Typical speedup is ~4x. Max possible speedup:
8x. * Add "scan" parameter to hook(), which is used to make the hook be called during the scanning pass, as well as the render pass. The meta and tag plugins need to use the new scan parameter, so will any others that modify %links. * Now that links are calculated in a separate pass, it can also precalculate backlinks in one pass, which is O(N^2) instead of the previous code that was O(N^3). A very nice speedup for wikis with lots (thousands) of pages.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 80208ef2b..a6869d454 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -446,10 +446,11 @@ sub linkify ($$$) { #{{{
} #}}}
my %preprocessing;
-sub preprocess ($$$) { #{{{
+sub preprocess ($$$;$) { #{{{
my $page=shift; # the page the data comes from
my $destpage=shift; # the page the data will appear in (different for inline)
my $content=shift;
+ my $scan=shift;
my $handle=sub {
my $escape=shift;
@@ -459,6 +460,7 @@ sub preprocess ($$$) { #{{{
return "[[$command $params]]";
}
elsif (exists $hooks{preprocess}{$command}) {
+ return "" if $scan && ! $hooks{preprocess}{$command}{scan};
# Note: preserve order of params, some plugins may
# consider it significant.
my @params;