summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-01-28 23:48:27 -0500
committerJoey Hess <joey@kodama.kitenet.net>2008-01-28 23:48:27 -0500
commit2d3dc86d07a7ebf5f638084259ae2d9c2c63e6b6 (patch)
treebecad53508f7fe1bf5cfd76569e57ccc2a68b5e8 /IkiWiki/Plugin
parent1b8f1b867c25c5287926ca538c1b04dbfc17f033 (diff)
* prettydate,ddate: Don't ignore time formats passed to displaytime
function.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/ddate.pm6
-rw-r--r--IkiWiki/Plugin/prettydate.pm5
2 files changed, 9 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/ddate.pm b/IkiWiki/Plugin/ddate.pm
index 6b67f4202..d081cb509 100644
--- a/IkiWiki/Plugin/ddate.pm
+++ b/IkiWiki/Plugin/ddate.pm
@@ -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
diff --git a/IkiWiki/Plugin/prettydate.pm b/IkiWiki/Plugin/prettydate.pm
index b6110e427..745e6a1de 100644
--- a/IkiWiki/Plugin/prettydate.pm
+++ b/IkiWiki/Plugin/prettydate.pm
@@ -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);
} #}}}