From: David Riebenbauer Date: Sun, 31 Jan 2010 01:31:12 +0000 (+0100) Subject: Add a function add_autofiles(). X-Git-Tag: 3.20100427~62^2~28^2~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b18fde2bde0c7d445fd4aab3cd35add8c211aab4;p=ikiwiki.git Add a function add_autofiles(). The objective is to provide a sensible way to let plugins add files during the "scan stage" of the build. Currently does a little verification and adds the file to the global array @add_autofiles. --- diff --git a/IkiWiki.pm b/IkiWiki.pm index cb1c46a68..115c512d3 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -14,7 +14,7 @@ use open qw{:utf8 :std}; use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase %pagestate %wikistate %renderedfiles %oldrenderedfiles %pagesources %destsources %depends %depends_simple %hooks - %forcerebuild %loaded_plugins}; + %forcerebuild %loaded_plugins @autofiles}; use Exporter q{import}; our @EXPORT = qw(hook debug error template htmlpage deptype @@ -1898,6 +1898,14 @@ sub add_link ($$) { unless grep { $_ eq $link } @{$links{$page}}; } +sub add_autofile ($) { + my $addfile=shift; + my ($file,$page) = verify_src_file($addfile,$config{srcdir}); + if ($page) { + push @autofiles, $file; + } +} + sub pagespec_translate ($) { my $spec=shift;