summaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-04-17 13:35:15 -0400
committerJoey Hess <joey@kitenet.net>2010-04-17 13:35:15 -0400
commitb7d50abc0f3dbe99d2a3664c12ea95d24bfcf04b (patch)
treebd716da03086a6c47df994723d424454c090649d /IkiWiki.pm
parent2269a4c74b24378d8e7e2229ca3374a197d08d9c (diff)
refactor autofiles
Made add_autofile take a generator function, and just register the autofile, for later possible creation. The testing is moved into Render, which allows cleaning up some stuff.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm35
1 files changed, 10 insertions, 25 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 3812961dc..c22c75df8 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -15,7 +15,7 @@ use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
%pagestate %wikistate %renderedfiles %oldrenderedfiles
%pagesources %destsources %depends %depends_simple %hooks
%forcerebuild %loaded_plugins %typedlinks %oldtypedlinks
- %autofiles %del_hash};
+ %autofiles};
use Exporter q{import};
our @EXPORT = qw(hook debug error template htmlpage deptype
@@ -1956,6 +1956,15 @@ sub add_link ($$;$) {
}
}
+sub add_autofile ($$$) {
+ my $file=shift;
+ my $plugin=shift;
+ my $generator=shift;
+
+ $autofiles{$file}{plugin}=$plugin;
+ $autofiles{$file}{generator}=$generator;
+}
+
sub sortspec_translate ($$) {
my $spec = shift;
my $reverse = shift;
@@ -2021,30 +2030,6 @@ sub sortspec_translate ($$) {
return eval 'sub { '.$code.' }';
}
-sub add_autofile ($$) {
- my $autofile=shift;
- my $plugin=shift;
-
- if (srcfile($autofile, 1)) {
- return 0;
- }
-
- my ($file, $page) = verify_src_file("$config{srcdir}/$autofile", $config{srcdir});
-
- if ((!defined $file) ||
- (exists $pagestate{$page}{$plugin}{autofile_deleted})) {
- return 0;
- }
-
- if (exists $del_hash{$file}) {
- $pagestate{$page}{$plugin}{autofile_deleted}=1;
- return 0;
- }
-
- $autofiles{$file}=$plugin;
- return 1;
-}
-
sub pagespec_translate ($) {
my $spec=shift;