aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm7
-rw-r--r--IkiWiki/Render.pm11
-rwxr-xr-xpo/po2wiki2
3 files changed, 18 insertions, 2 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index d8cfc31cc..9511c8303 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -14,7 +14,7 @@ use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
%pagestate %wikistate %renderedfiles %oldrenderedfiles
%pagesources %delpagesources %destsources %depends %depends_simple
@mass_depends %hooks %forcerebuild %loaded_plugins %typedlinks
- %oldtypedlinks %autofiles @underlayfiles $lastrev};
+ %oldtypedlinks %autofiles @underlayfiles $lastrev $phase};
use Exporter q{import};
our @EXPORT = qw(hook debug error htmlpage template template_depends
@@ -34,6 +34,11 @@ our $DEPEND_CONTENT=1;
our $DEPEND_PRESENCE=2;
our $DEPEND_LINKS=4;
+# Phases of processing.
+sub PHASE_SCAN () { 0 }
+sub PHASE_RENDER () { 1 }
+$phase = PHASE_SCAN;
+
# Optimisation.
use Memoize;
memoize("abs2rel");
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 9e93534c6..c88de1e8e 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -827,6 +827,8 @@ sub gen_autofile ($$$) {
}
sub refresh () {
+ $phase = PHASE_SCAN;
+
srcdir_check();
run_hooks(refresh => sub { shift->() });
my ($files, $pages, $new, $internal_new, $del, $internal_del, $changed, $internal_changed);
@@ -878,7 +880,10 @@ sub refresh () {
}
calculate_links();
-
+
+ # At this point it becomes OK to start matching pagespecs.
+ $phase = PHASE_RENDER;
+
remove_del(@$del, @$internal_del);
foreach my $file (@$changed) {
@@ -942,6 +947,10 @@ sub commandline_render () {
loadindex();
unlockwiki();
+ # This function behaves as though it's in the render phase;
+ # all other files are assumed to have been scanned last time.
+ $phase = PHASE_RENDER;
+
my $srcfile=possibly_foolish_untaint($config{render});
my $file=$srcfile;
$file=~s/\Q$config{srcdir}\E\/?//;
diff --git a/po/po2wiki b/po/po2wiki
index 126aa8e17..862aa9d97 100755
--- a/po/po2wiki
+++ b/po/po2wiki
@@ -22,6 +22,8 @@ foreach my $file (@$files) {
$pagesources{$page}=$file; # used by po plugin functions
}
+$IkiWiki::phase = IkiWiki::PHASE_RENDER;
+
foreach my $lang (@{$config{po_slave_languages}}) {
my ($ll, $name)=IkiWiki::Plugin::po::splitlangpair($lang);
$config{destdir}="../underlays/locale/$ll";