]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
(no commit message)
authorluke.schierer@502bb1c5e3da2bf0a6a8c76f17674b51d178247b <lukeschierer@web>
Wed, 11 Nov 2020 20:48:01 +0000 (16:48 -0400)
committeradmin <admin@branchable.com>
Wed, 11 Nov 2020 20:48:01 +0000 (16:48 -0400)
doc/todo/more_flexibility_in_the_date_parameter_for_the_meta_plugin.mdwn

index a4ed2d8491f1d68fee74bee974b1247d0e701515..0ec1bdb63538db39d21559e2a068d6f721c6f2b9 100644 (file)
@@ -1 +1,35 @@
 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. 
+
+```
+luke@schierer@opus001:~/src/ikiwiki/ikiwiki$ cat meta_date_manip.patch
+diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
+index cd367da70..dbcf99aea 100644
+--- a/IkiWiki/Plugin/meta.pm
++++ b/IkiWiki/Plugin/meta.pm
+@@ -152,9 +152,9 @@ sub preprocess (@) {
+                # fallthrough
+        }
+        elsif ($key eq 'date') {
+-               eval q{use Date::Parse};
++               eval q{use Date::Manip};
+                if (! $@) {
+-                       my $time = str2time($value);
++                       my $time = UnixDate( ParseDate($value), "%s");
+                        if (defined $time) {
+                                $IkiWiki::pagectime{$page}=$time;
+                        }
+@@ -167,9 +167,9 @@ sub preprocess (@) {
+                }
+        }
+        elsif ($key eq 'updated') {
+-               eval q{use Date::Parse};
++               eval q{use Date::Manip};
+                if (! $@) {
+-                       my $time = str2time($value);
++                       my $time = UnixDate ( ParseDate($value), "%s");
+                        if (defined $time) {
+                                $pagestate{$page}{meta}{updated}=$time;
+                        }
+luke@schierer@opus001:~/src/ikiwiki/ikiwiki$ 
+```
+