meta: Make syntactically invalid dates an error
If for some reason you want to create <meta name="date" content="12345">, this now requires [[!meta name="date" content="12345"]]. Signed-off-by: Simon McVittie <smcv@debian.org>master
parent
3a640455cc
commit
88c66d3758
|
@ -155,14 +155,24 @@ sub preprocess (@) {
|
||||||
eval q{use Date::Parse};
|
eval q{use Date::Parse};
|
||||||
if (! $@) {
|
if (! $@) {
|
||||||
my $time = str2time($value);
|
my $time = str2time($value);
|
||||||
$IkiWiki::pagectime{$page}=$time if defined $time;
|
if (defined $time) {
|
||||||
|
$IkiWiki::pagectime{$page}=$time;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error(sprintf(gettext('cannot parse date/time: %s'), $value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ($key eq 'updated') {
|
elsif ($key eq 'updated') {
|
||||||
eval q{use Date::Parse};
|
eval q{use Date::Parse};
|
||||||
if (! $@) {
|
if (! $@) {
|
||||||
my $time = str2time($value);
|
my $time = str2time($value);
|
||||||
$pagestate{$page}{meta}{updated}=$time if defined $time;
|
if (defined $time) {
|
||||||
|
$pagestate{$page}{meta}{updated}=$time;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error(sprintf(gettext('cannot parse date/time: %s'), $value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue