diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2010-04-15 13:40:53 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2010-04-15 13:40:53 -0400 |
commit | 3131433f64235ad5425eb93d5773580b607876fb (patch) | |
tree | f92e1875f8b3ad155ecc75414eaafab6d98d9969 | |
parent | 81ce1cf9daf113c88581407d5e68d8f6ee61d674 (diff) | |
download | ikiwiki-3131433f64235ad5425eb93d5773580b607876fb.tar ikiwiki-3131433f64235ad5425eb93d5773580b607876fb.tar.gz |
calendar: Add archive_pagespec, which is used by ikiwiki-calendar to specify which pages to include on the calendar archive pages. (The pagespec can still also be specified on the ikiwiki-calendar command line.)
-rw-r--r-- | IkiWiki/Plugin/calendar.pm | 8 | ||||
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | doc/ikiwiki-calendar.mdwn | 8 | ||||
-rw-r--r-- | doc/ikiwiki/directive/calendar.mdwn | 7 | ||||
-rwxr-xr-x | ikiwiki-calendar.in | 6 |
5 files changed, 27 insertions, 6 deletions
diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index ff84bc440..0f0e9518a 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -47,6 +47,14 @@ sub getsetup () { safe => 1, rebuild => 1, }, + archive_pagespec => { + type => "pagespec", + example => "posts/* and !*/Discussion", + description => "PageSpec of pages to include in the archives; used by ikiwiki-calendar command", + link => 'ikiwiki/PageSpec', + safe => 1, + rebuild => 0, + }, } sub is_leap_year (@) { diff --git a/debian/changelog b/debian/changelog index 26b00a07c..7c607b2a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,6 +27,10 @@ ikiwiki (3.20100410) UNRELEASED; urgency=low for master language. * po: Configuring the same language as master and slave confuses processing; so filter out such a misconfiguration. + * calendar: Add archive_pagespec, which is used by ikiwiki-calendar to + specify which pages to include on the calendar archive pages. + (The pagespec can still also be specified on the ikiwiki-calendar command + line.) -- Joey Hess <joeyh@debian.org> Sun, 04 Apr 2010 12:17:11 -0400 diff --git a/doc/ikiwiki-calendar.mdwn b/doc/ikiwiki-calendar.mdwn index 982892fca..c1f4d7267 100644 --- a/doc/ikiwiki-calendar.mdwn +++ b/doc/ikiwiki-calendar.mdwn @@ -16,9 +16,11 @@ You must specify the setup file for your wiki. The pages will be created inside its `srcdir`, beneath the `archivebase` directory used by the calendar plugin (default "archives"). -You will probably want to specify a [[ikiwiki/PageSpec]] -to control which pages are included on the calendars. The -default is all pages. To limit it to only posts in a blog, +To control which pages are included on the calendars, +a [[ikiwiki/PageSpec]] can be specified. The default is +all pages, or the pages specified by the `comments_pagespec` +setting in the config file. A pagespec can also be specified +on the command line. To limit it to only posts in a blog, use something like "posts/* and !*/Discussion". It defaults to creating calendar pages for the current diff --git a/doc/ikiwiki/directive/calendar.mdwn b/doc/ikiwiki/directive/calendar.mdwn index b2ac75b11..8a08081ee 100644 --- a/doc/ikiwiki/directive/calendar.mdwn +++ b/doc/ikiwiki/directive/calendar.mdwn @@ -40,9 +40,12 @@ An example crontab: "month" or "year". The default is a month view calendar. * `pages` - Specifies the [[ikiwiki/PageSpec]] of pages to link to from the month calendar. Defaults to "*". -* `archivebase` - Configures the base of the archives hierarchy. The - default is "archives". Note that this default can also be overridden +* `archivebase` - Configures the base of the archives hierarchy. + The default is "archives". Note that this default can also be overridden for the whole wiki by setting `archivebase` in ikiwiki's setup file. + Calendars link to pages under here, with names like "2010/04" and + "2010". These pages can be automatically created using the + [[ikiwiki-calendar]] tool. * `year` - The year for which the calendar is requested. Defaults to the current year. * `month` - The numeric month for which the calendar is requested, in the diff --git a/ikiwiki-calendar.in b/ikiwiki-calendar.in index 9738ea5f7..6b6f693b3 100755 --- a/ikiwiki-calendar.in +++ b/ikiwiki-calendar.in @@ -15,7 +15,7 @@ GetOptions( "force" => \$force, ) || usage(); my $setup=shift || usage(); -my $pagespec=shift || "*"; +my $pagespec=shift; my $startyear=shift || 1900+(localtime(time))[5]; my $endyear=shift || $startyear; @@ -27,6 +27,10 @@ IkiWiki::checkconfig(); my $archivebase = 'archives'; $archivebase = $config{archivebase} if defined $config{archivebase}; +if (! defined $pagespec) { + $pagespec=$config{archive_pagespec} || "*"; +} + sub writearchive ($$;$) { my $template=template(shift); my $year=shift; |