aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis <spalax@gresille.org>2014-07-07 09:40:53 +0200
committerLouis <spalax@gresille.org>2014-07-07 09:40:53 +0200
commit492a22ac75f8b41a427a98c44525b01a6fd181b5 (patch)
tree893b5f289407dd268462dd15e403c3de7c451c74
parent59b46942e01b32138d056381249effbbaf773892 (diff)
downloadikiwiki-492a22ac75f8b41a427a98c44525b01a6fd181b5.tar
ikiwiki-492a22ac75f8b41a427a98c44525b01a6fd181b5.tar.gz
Making use of the transient plugin
-rw-r--r--IkiWiki/Plugin/calendar.pm26
-rw-r--r--doc/plugins/calendar.mdwn5
2 files changed, 5 insertions, 26 deletions
diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
index 6fcd8c2ca..185026d20 100644
--- a/IkiWiki/Plugin/calendar.pm
+++ b/IkiWiki/Plugin/calendar.pm
@@ -32,6 +32,8 @@ sub import {
hook(type => "needsbuild", id => "calendar", call => \&needsbuild);
hook(type => "preprocess", id => "calendar", call => \&preprocess);
hook(type => "scan", id => "calendar", call => \&scan);
+
+ IkiWiki::loadplugin("transient");
}
sub getsetup () {
@@ -63,14 +65,6 @@ sub getsetup () {
safe => 1,
rebuild => undef,
},
- calendar_autocreate_commit => {
- type => "boolean",
- example => 1,
- default => 1,
- description => "commit autocreated calendar pages",
- safe => 1,
- rebuild => 0,
- },
calendar_fill_gaps => {
type => "boolean",
example => 1,
@@ -83,10 +77,7 @@ sub getsetup () {
sub checkconfig () {
if (! defined $config{calendar_autocreate}) {
- $config{calendar_autocreate} = defined $config{archivebase} || defined $config{calendar_autocreate_commit};
- }
- if (! defined $config{calendar_autocreate_commit}) {
- $config{calendar_autocreate_commit} = 1;
+ $config{calendar_autocreate} = defined $config{archivebase};
}
if (! defined $config{archive_pagespec}) {
$config{archive_pagespec} = '*';
@@ -128,18 +119,9 @@ sub autocreate {
$template->param(month => $month) if defined $month;
$template->param(pagespec => $config{archive_pagespec});
- my $dir = $config{srcdir};
- if (! $config{calendar_autocreate_commit}) {
- $dir = $IkiWiki::Plugin::transient::transientdir;
- }
+ my $dir = $IkiWiki::Plugin::transient::transientdir;
writefile($pagefile, $dir, $template->output);
- if ($config{rcs} && $config{calendar_autocreate_commit}) {
- IkiWiki::disable_commit_hook();
- IkiWiki::rcs_add($pagefile);
- IkiWiki::rcs_commit_staged(message => $message);
- IkiWiki::enable_commit_hook();
- }
}
sub calendarlink($;$) {
diff --git a/doc/plugins/calendar.mdwn b/doc/plugins/calendar.mdwn
index b7dd3b206..fb3cfb130 100644
--- a/doc/plugins/calendar.mdwn
+++ b/doc/plugins/calendar.mdwn
@@ -15,10 +15,7 @@ pages from templates (overriding the existing ones).
* `archive_pagespec` - [[ikiwiki/PageSpec]] of pages to include in the
archives, if option `calendar_autocreate` is on. It defaults to `*`.
* `calendar_autocreate` - Control whether new archive pages are created as
- needed. It defaults to being done only if (at least) one of options
- `archivebase` and `calendar_autocreate_commit` are set.
-* `calendar_autocreate_commit` - If set, causes new archive pages to be
- checked into version control. Defaults to 1.
+ needed. It defaults to being done only if option `archivebase` is set.
* `calendar_fill_gaps` - If set (and `calendar_autocreate` is set as well),
build calendar pages of emty years and months (but does not build pages older
than the older page, and younger than the younger page of the pagespec). If