summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm14
-rw-r--r--doc/ikiwiki/pagespec.mdwn1
2 files changed, 14 insertions, 1 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 2190f008c..1fa89586e 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -2608,6 +2608,10 @@ sub match_created_after ($$;@) {
}
sub match_creation_day ($$;@) {
+ my $d=shift;
+ if ($d !~ /^\d+$/) {
+ return IkiWiki::ErrorReason->new("invalid day $d");
+ }
if ((localtime($IkiWiki::pagectime{shift()}))[3] == shift) {
return IkiWiki::SuccessReason->new('creation_day matched');
}
@@ -2617,6 +2621,10 @@ sub match_creation_day ($$;@) {
}
sub match_creation_month ($$;@) {
+ my $m=shift;
+ if ($m !~ /^\d+$/) {
+ return IkiWiki::ErrorReason->new("invalid month $m");
+ }
if ((localtime($IkiWiki::pagectime{shift()}))[4] + 1 == shift) {
return IkiWiki::SuccessReason->new('creation_month matched');
}
@@ -2626,7 +2634,11 @@ sub match_creation_month ($$;@) {
}
sub match_creation_year ($$;@) {
- if ((localtime($IkiWiki::pagectime{shift()}))[5] + 1900 == shift) {
+ my $y=shift;
+ if ($y !~ /^\d+$/) {
+ return IkiWiki::ErrorReason->new("invalid year $y");
+ }
+ if ((localtime($IkiWiki::pagectime{shift()}))[5] + 1900 == $y) {
return IkiWiki::SuccessReason->new('creation_year matched');
}
else {
diff --git a/doc/ikiwiki/pagespec.mdwn b/doc/ikiwiki/pagespec.mdwn
index 6aec561ae..fe1af4c15 100644
--- a/doc/ikiwiki/pagespec.mdwn
+++ b/doc/ikiwiki/pagespec.mdwn
@@ -32,6 +32,7 @@ Some more elaborate limits can be added to what matches using these functions:
tags matched by a glob)
* "`backlink(page)`" - matches only pages that a given page links to
* "`creation_month(month)`" - matches only files created on the given month
+ number
* "`creation_day(mday)`" - or day of the month
* "`creation_year(year)`" - or year
* "`created_after(page)`" - matches only files created after the given page