Suggestion to change

    0 0 * * * ikiwiki-calendar ~/ikiwiki.setup "posts/* and !*/Discussion"

to

    0 0 * * * ikiwiki-calendar ~/ikiwiki.setup 'posts/* and !*/Discussion'

I ran into (for me) unexpected behaviour with double quotes, since when I tried it in the interactive shell, the "!" made it fail ([history expansion](http://mywiki.wooledge.org/BashPitfalls#echo_.22Hello_World.21.22)). I thought "aha, it should be escaped!", did so, and did not get any error messages, but it no longer functioned as intended (as per the earlier linked page).

The latter line will work everywhere, not just in environments without history expansion. I think trying a command manually before putting it into crontab is common, and this would avoid the possible user issue I ran into.

----

I wonder what this program (ikiwiki-calendar) is useful for. Would not it be simpler to have the [[calendar|ikiwiki/directive/calendar]] directive generate the `archive_base/year/month.mdwn` files on the fly, as are the tag pages generated by the [[tag|plugins/tag]] plugin? This solution would have the advantage of automatically generating the right calendar pages, instead of having to tell ikiwiki-calendar which years to take into account.

Using this solution would mean to have the pagespec stored somewhere in the configuration. But this is already the case, as the pagespec used by [[ikiwiki-calendar]] is either set in the configuration file of the wiki, or in the crontab or whatever script used to call ikiwiki-calendar.

Having done this, the only purpose of ikiwiki-calendar would be to re-generate the wiki on a daily (or whatever frequency) basis, which can be done using ikiwiki instead of ikiwiki-calendar.

Did I miss something? If I am right, I offer to write the necessary patch, copied and adapted from the tag plugin, to generate the pages `archive_base/year/month.mdwn` on the fly.

-- [[Louis|spalax]]

> Good spotting, `ikiwiki-calendar` predates the `add_autofile` API used to
> autocreate tag pages and was bolted in as an easy way to create calendar
> pages.
> 
> It would be possible to do that inside the caneldar plugin now. Although
> some command would still need to be run on a daily (or weekly, or
> monthly, or yearly..) basis to have it wake up and make the new calendar
> pages and update the displayed current day from calendar directives.
> 
> That last is, arguably, the real point of running ikiwiki-calendar in
> a cron job. Of course all it really does is run `ikiwiki -setup foo
> -refresh`. --[[Joey]]

> > [[Patch|todo/calendar_autocreate]]. -- [[Louis|spalax]]
