summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-14 22:42:22 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-14 22:42:22 -0400
commit3256522bdaf2ca7c678041a19a4b97bd7dc57c90 (patch)
treea9fdd3b36ea778766d1789a8cc740f7ed48909ed
parenta8daf61b7d3c38e95ba8a168cdba3dfbce750e16 (diff)
parentb29d11b3c67533ca7addadb40a818a88cf6b8a84 (diff)
Merge commit 'smcv/aggregateinternal' into aggregateinternal
Conflicts: doc/plugins/aggregate.mdwn
-rw-r--r--IkiWiki/Plugin/aggregate.pm6
-rw-r--r--doc/ikiwiki-transition.mdwn2
-rw-r--r--doc/plugins/aggregate.mdwn7
-rw-r--r--doc/todo/aggregate_to_internal_pages.mdwn2
-rwxr-xr-xikiwiki-transition10
5 files changed, 16 insertions, 11 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 2fcdec9e7..f648a3f99 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -132,9 +132,11 @@ sub migrate_to_internal { #{{{
foreach my $data (values %guids) {
next unless $data->{page};
+ next if $data->{expired};
$config{aggregateinternal} = 0;
my $oldname = pagefile($data->{page});
+ my $oldoutput = $config{destdir}."/".IkiWiki::htmlpage($data->{page});
$config{aggregateinternal} = 1;
my $newname = pagefile($data->{page});
@@ -154,6 +156,10 @@ sub migrate_to_internal { #{{{
else {
debug("$oldname not found");
}
+ if (-e $oldoutput) {
+ debug("removing output file $oldoutput");
+ unlink($oldoutput) || error ("$!");
+ }
}
savestate();
diff --git a/doc/ikiwiki-transition.mdwn b/doc/ikiwiki-transition.mdwn
index 624268d23..3290ca7e9 100644
--- a/doc/ikiwiki-transition.mdwn
+++ b/doc/ikiwiki-transition.mdwn
@@ -28,7 +28,7 @@ treat these as preprocessor directives and convert them.
# aggregateinternal
The `aggregateinternal` mode moves pages aggregated by the aggregate plugin
-so that the `aggregateinternal` option can be endabled
+so that the `aggregateinternal` option can be enabled.
# indexdb
diff --git a/doc/plugins/aggregate.mdwn b/doc/plugins/aggregate.mdwn
index d87e33ab9..ecca0232e 100644
--- a/doc/plugins/aggregate.mdwn
+++ b/doc/plugins/aggregate.mdwn
@@ -101,8 +101,7 @@ you should follow this process:
be changed to `internal(foo/*)`. This has to be done because internal
pages are not matched by regular globs.
2. Turn on `aggregateinternal` in the setup file.
-3. Use [[ikiwiki-transition]] to move all existing aggregated `.html`
- files. The command to run is `ikiwiki-transition aggregateinternal $srcdir`,
- or if you have changed the `htmlext` option to something other than "html",
- `ikiwiki-transition aggregateinternal $srcdir $htmlext`
+3. Use [[ikiwiki-transition]] to rename all existing aggregated `.html`
+ files in the srcdir. The command to run is
+ `ikiwiki-transition aggregateinternal $setupfile`,
4. Refresh the wiki. (`ikiwiki -setup your.setup -refresh`)
diff --git a/doc/todo/aggregate_to_internal_pages.mdwn b/doc/todo/aggregate_to_internal_pages.mdwn
index 7eddc5891..38427133f 100644
--- a/doc/todo/aggregate_to_internal_pages.mdwn
+++ b/doc/todo/aggregate_to_internal_pages.mdwn
@@ -53,7 +53,7 @@ change their pagespecs to use `internal()`.
> I've patched ikiwiki-transition to have an aggregateinternal mode.
> See my aggregateinternal branch, again.
-> "ikiwiki-transition aggregateinternal $srcdir $htmlext" moves the pages around,
+> "ikiwiki-transition aggregateinternal $setupfile" moves the pages around,
> although it doesn't update the pagespecs (I wouldn't know how...) --[[smcv]]
[[tag patch done]]
diff --git a/ikiwiki-transition b/ikiwiki-transition
index 6524297ee..3e2c89bf9 100755
--- a/ikiwiki-transition
+++ b/ikiwiki-transition
@@ -100,12 +100,12 @@ sub hashpassword {
}
sub aggregateinternal {
- $config{srcdir} = shift;
- $config{wikistatedir} = $config{srcdir}."/.ikiwiki";
- $config{htmlext} = (shift or "html");
-
+ require IkiWiki::Setup;
require IkiWiki::Plugin::aggregate;
+ %config = (IkiWiki::defaultconfig(), IkiWiki::Setup::load(shift));
+ IkiWiki::checkconfig();
+
IkiWiki::Plugin::aggregate::migrate_to_internal();
print "... now add aggregateinternal => 1 to your .setup file\n";
@@ -117,7 +117,7 @@ sub usage {
print STDERR " prefix_directives file\n";
print STDERR " indexdb srcdir\n";
print STDERR " hashpassword srcdir\n";
- print STDERR " aggregateinternal srcdir [htmlext]\n";
+ print STDERR " aggregateinternal setupfile\n";
exit 1;
}