aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2010-12-25 23:02:47 +0000
committerSimon McVittie <smcv@debian.org>2011-01-22 22:36:41 +0000
commit059259ecd1f974b98718bf05f8be63fa0e7c4e32 (patch)
tree59f12cd281ff063b76449bc412aa19e682869660 /IkiWiki
parent594a9194561ad373a31a7d34c6b5c7a84ec417a0 (diff)
downloadikiwiki-059259ecd1f974b98718bf05f8be63fa0e7c4e32.tar
ikiwiki-059259ecd1f974b98718bf05f8be63fa0e7c4e32.tar.gz
Allow autoindex files to be written into the transient underlay
As with the tag plugin, for the moment keep the old behaviour in the test.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/autoindex.pm18
1 files changed, 16 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm
index 5a58c820a..d02618581 100644
--- a/IkiWiki/Plugin/autoindex.pm
+++ b/IkiWiki/Plugin/autoindex.pm
@@ -9,6 +9,7 @@ use Encode;
sub import {
hook(type => "getsetup", id => "autoindex", call => \&getsetup);
hook(type => "refresh", id => "autoindex", call => \&refresh);
+ IkiWiki::loadplugin("transient");
}
sub getsetup () {
@@ -17,6 +18,14 @@ sub getsetup () {
safe => 1,
rebuild => 0,
},
+ autoindex_commit => {
+ type => "boolean",
+ example => 1,
+ default => 1,
+ description => "commit autocreated index pages",
+ safe => 1,
+ rebuild => 0,
+ },
}
sub genindex ($) {
@@ -28,11 +37,16 @@ sub genindex ($) {
$page);
debug($message);
+ my $dir = $config{srcdir};
+ if (! $config{autoindex_commit}) {
+ $dir = $IkiWiki::Plugin::transient::transientdir;
+ }
+
my $template = template("autoindex.tmpl");
$template->param(page => $page);
- writefile($file, $config{srcdir}, $template->output);
+ writefile($file, $dir, $template->output);
- if ($config{rcs}) {
+ if ($config{rcs} && $config{autoindex_commit}) {
IkiWiki::disable_commit_hook();
IkiWiki::rcs_add($file);
IkiWiki::rcs_commit_staged(message => $message);