]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* prettydate,ddate: Don't ignore time formats passed to displaytime
authorJoey Hess <joey@kodama.kitenet.net>
Tue, 29 Jan 2008 04:48:27 +0000 (23:48 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Tue, 29 Jan 2008 04:48:27 +0000 (23:48 -0500)
    function.

IkiWiki/Plugin/ddate.pm
IkiWiki/Plugin/prettydate.pm
debian/changelog

index 6b67f420232adcc835800c5b4729a47a5a7eb1a6..d081cb5094d56b5030ba54f7504d911785000643 100644 (file)
@@ -18,6 +18,10 @@ sub checkconfig () { #{{{
 
 sub IkiWiki::displaytime ($;$) { #{{{
        my $time=shift;
+       my $format=shift;
+       if (! defined $format) {
+               $format=$config{timeformat};
+       }
        eval q{
                use DateTime;
                use DateTime::Calendar::Discordian;
@@ -27,7 +31,7 @@ sub IkiWiki::displaytime ($;$) { #{{{
        }
        my $dt = DateTime->from_epoch(epoch => $time);
        my $dd = DateTime::Calendar::Discordian->from_object(object => $dt);
-       return $dd->strftime($IkiWiki::config{timeformat});
+       return $dd->strftime($format);
 } #}}}
 
 5
index b6110e427b5ca9c9326f572ce2d3df7b955d226f..745e6a1de436e2db15b97ebe897858f891de2a51 100644 (file)
@@ -63,6 +63,10 @@ sub checkconfig () { #{{{
 
 sub IkiWiki::displaytime ($;$) { #{{{
        my $time=shift;
+       my $format=shift;
+       if (! defined $format) {
+               $format=$config{prettydateformat};
+       }
        
        eval q{use Date::Format};
        error($@) if $@;
@@ -93,7 +97,6 @@ sub IkiWiki::displaytime ($;$) { #{{{
 
        $t=~s{\%A-}{my @yest=@t; $yest[6]--; strftime("%A", \@yest)}eg;
 
-       my $format=$config{prettydateformat};
        $format=~s/\%X/$t/g;
        return strftime($format, \@t);
 } #}}}
index 6af99590de7f7986a8a140055637771c8f342ea8..b098bf9663326df35edcd1f26fbdabde0bfd82d2 100644 (file)
@@ -19,6 +19,8 @@ ikiwiki (2.21) UNRELEASED; urgency=low
   * inline: The template can check for FIRST and LAST, which will be
     set for the first and last inlined page. Useful for templates that build
     tables and the like.
+  * prettydate,ddate: Don't ignore time formats passed to displaytime
+    function.
 
  -- Joey Hess <joeyh@debian.org>  Fri, 11 Jan 2008 15:09:37 -0500