]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/todo/more_flexibility_in_the_date_parameter_for_the_meta_plugin.mdwn
0ec1bdb63538db39d21559e2a068d6f721c6f2b9
[git.ikiwiki.info.git] / doc / todo / more_flexibility_in_the_date_parameter_for_the_meta_plugin.mdwn
1 Changing from perl Date::Parse to Date::Manip causes it to accept some strings that it otherwise could not.  This is mostly dealing with situations where it has to infer values from partial date strings, but sometimes that is useful. 
3 ```
4 luke@schierer@opus001:~/src/ikiwiki/ikiwiki$ cat meta_date_manip.patch
5 diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
6 index cd367da70..dbcf99aea 100644
7 --- a/IkiWiki/Plugin/meta.pm
8 +++ b/IkiWiki/Plugin/meta.pm
9 @@ -152,9 +152,9 @@ sub preprocess (@) {
10                 # fallthrough
11         }
12         elsif ($key eq 'date') {
13 -               eval q{use Date::Parse};
14 +               eval q{use Date::Manip};
15                 if (! $@) {
16 -                       my $time = str2time($value);
17 +                       my $time = UnixDate( ParseDate($value), "%s");
18                         if (defined $time) {
19                                 $IkiWiki::pagectime{$page}=$time;
20                         }
21 @@ -167,9 +167,9 @@ sub preprocess (@) {
22                 }
23         }
24         elsif ($key eq 'updated') {
25 -               eval q{use Date::Parse};
26 +               eval q{use Date::Manip};
27                 if (! $@) {
28 -                       my $time = str2time($value);
29 +                       my $time = UnixDate ( ParseDate($value), "%s");
30                         if (defined $time) {
31                                 $pagestate{$page}{meta}{updated}=$time;
32                         }
33 luke@schierer@opus001:~/src/ikiwiki/ikiwiki$ 
34 ```