]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/calendar.pm
Merge remote branch 'smcv/unescaped-meta'
[git.ikiwiki.info.git] / IkiWiki / Plugin / calendar.pm
index cbbb57e98c803d51cdf25d06eef3e88afe2d33af..ff84bc4409cd1f397980d4eb14b6d478a08cd70d 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",
@@ -137,7 +138,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 +147,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",
@@ -396,8 +397,14 @@ sub preprocess (@) {
        }
        elsif ($params{type} eq 'year' && $params{year} == $thisyear) {
                # calendar for current year, updates 1st of next month
-               $pagestate{$params{destpage}}{calendar}{nextchange}=
-                       timelocal(0, 0, 0, 1, $thismonth+1-1, $params{year});
+               if ($thismonth < 12) {
+                       $pagestate{$params{destpage}}{calendar}{nextchange}=
+                               timelocal(0, 0, 0, 1, $thismonth+1-1, $params{year});
+               }
+               else {
+                       $pagestate{$params{destpage}}{calendar}{nextchange}=
+                               timelocal(0, 0, 0, 1, 1-1, $params{year}+1);
+               }
        }
        elsif ($params{type} eq 'year' && $params{year} > $thisyear) {
                # calendar for upcoming year, updates 1st of that year