diff options
-rw-r--r-- | IkiWiki.pm | 19 | ||||
-rw-r--r-- | IkiWiki/Plugin/tag.pm | 2 | ||||
-rw-r--r-- | IkiWiki/Render.pm | 5 |
3 files changed, 20 insertions, 6 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 1770703a5..966a3bbc6 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 @autofiles}; + %forcerebuild %loaded_plugins %autofiles %del_hash}; use Exporter q{import}; our @EXPORT = qw(hook debug error template htmlpage deptype @@ -1895,17 +1895,28 @@ sub add_link ($$) { unless grep { $_ eq $link } @{$links{$page}}; } -sub add_autofile ($) { +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) { - push @autofiles, $file; + + 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 ($) { diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index c6c99ae45..fdd63d637 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -72,7 +72,7 @@ sub gentag ($) { my $tagfile = newpagefile(tagpage($tag), $config{default_pageext}); $tagfile=~s/^\///; - return if (! add_autofile($tagfile)); + return if (! add_autofile($tagfile, "tag")); debug(sprintf(gettext("creating tag page %s"), $tag)); diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index fc71c8919..0c21455fb 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -637,12 +637,14 @@ sub refresh () { my ($changed, $internal_changed)=find_changed($files); run_hooks(needsbuild => sub { shift->($changed) }); my $oldlink_targets=calculate_old_links($changed, $del); + %del_hash = map { $_ => 1 } @{$del}; foreach my $file (@$changed) { scan($file); } - while (my $autofile = shift (@autofiles)) { + while (my $autofile = shift @{[keys %autofiles]}) { + my $plugin=$autofiles{$autofile}; my $page=pagename($autofile); if ($pages->{$page}) { debug(sprintf(gettext("%s has multiple possible source pages"), $page)); @@ -654,6 +656,7 @@ sub refresh () { push @{$changed}, $autofile if find_changed([$autofile]); scan($autofile); + delete $autofiles{$autofile}; } calculate_links(); |