Merge remote branch 'davrieb/autotag' into autotag
[ikiwiki.git] / IkiWiki / Plugin / calendar.pm
index 77fd508275d09896ff63d4d87220505526fbaf30..aeb5f3d294693b93285fac9da87ab2564bd89add 100644 (file)
@@ -22,7 +22,7 @@ use warnings;
 use strict;
 use IkiWiki 3.00;
 use Time::Local;
-use POSIX;
+use POSIX ();
 
 my $time=time;
 my @now=localtime($time);
@@ -38,6 +38,7 @@ sub getsetup () {
                plugin => {
                        safe => 1,
                        rebuild => undef,
+                       section => "widget",
                },
                archivebase => {
                        type => "string",
@@ -46,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 (@) {
@@ -137,7 +146,7 @@ sub format_month (@) {
                $purl = htmllink($params{page}, $params{destpage}, 
                        "$archivebase/$pyear/$pmonth",
                        noimageinline => 1,
-                       linktext => "\&larr",
+                       linktext => "\←",
                        title => $pmonthname);
        }
        add_depends($params{page}, "$archivebase/$pyear/$pmonth",
@@ -146,7 +155,7 @@ sub format_month (@) {
                $nurl = htmllink($params{page}, $params{destpage}, 
                        "$archivebase/$nyear/$nmonth",
                        noimageinline => 1,
-                       linktext => "\&rarr",
+                       linktext => "\→",
                        title => $nmonthname);
        }
        add_depends($params{page}, "$archivebase/$nyear/$nmonth",
@@ -155,11 +164,11 @@ sub format_month (@) {
        # Start producing the month calendar
        $calendar=<<EOF;
 <table class="month-calendar">
-       <caption class="month-calendar-head">
-       $purl
-       $url
-       $nurl
-       </caption>
+       <tr>
+       <th class="month-calendar-arrow">$purl</th>
+       <th class="month-calendar-head" colspan="5">$url</th>
+       <th class="month-calendar-arrow">$nurl</th>
+       </tr>
        <tr>
 EOF
 
@@ -303,13 +312,14 @@ sub format_year (@) {
        add_depends($params{page}, "$archivebase/$nyear", deptype("presence"));
 
        # Start producing the year calendar
+       my $m=$params{months_per_row}-2;
        $calendar=<<EOF;
 <table class="year-calendar">
-       <caption class="year-calendar-head">
-       $purl
-       $url
-       $nurl
-       </caption>
+       <tr>
+       <th class="year-calendar-arrow">$purl</th>
+       <th class="year-calendar-head" colspan="$m">$url</th>
+       <th class="year-calendar-arrow">$nurl</th>
+       </tr>
        <tr>
                <th class="year-calendar-subhead" colspan="$params{months_per_row}">Months</th>
        </tr>