X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/be55f6fd7cf1a251c3977f857a44ee2769e39d8b..d8b4819d883e674913e07e18f5bb2678b832fd01:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index 168d800ba..1d9d2492c 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -14,7 +14,7 @@ use vars qw{%config %links %oldlinks %oldpagemtime %pagectime %pagecase use Exporter q{import}; our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match bestlink htmllink readfile writefile pagetype srcfile pagename - displaytime + displaytime will_render %config %links %renderedfiles %pagesources); our $VERSION = 1.01; # plugin interface version @@ -264,6 +264,7 @@ sub writefile ($$$;$) { #{{{ close OUT; } #}}} +my %cleared; sub will_render ($$;$) { #{{{ my $page=shift; my $dest=shift; @@ -275,11 +276,12 @@ sub will_render ($$;$) { #{{{ error("$config{destdir}/$dest independently created, not overwriting with version from $page"); } - if (! $clear) { + if (! $clear || $cleared{$page}) { $renderedfiles{$page}=[$dest, grep { $_ ne $dest } @{$renderedfiles{$page}}]; } else { $renderedfiles{$page}=[$dest]; + $cleared{$page}=1; } } #}}} @@ -444,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; @@ -457,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; @@ -505,7 +509,7 @@ sub preprocess ($$$) { #{{{ return $content; } #}}} -sub filter ($$) { +sub filter ($$) { #{{{ my $page=shift; my $content=shift; @@ -514,7 +518,7 @@ sub filter ($$) { }); return $content; -} +} #}}} sub indexlink () { #{{{ return "$config{wikiname}"; @@ -641,6 +645,8 @@ sub hook (@) { # {{{ if (! exists $param{type} || ! ref $param{call} || ! exists $param{id}) { error "hook requires type, call, and id parameters"; } + + return if $param{no_override} && exists $hooks{$param{type}}{$param{id}}; $hooks{$param{type}}{$param{id}}=\%param; } # }}}