summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-05-29 05:09:43 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-05-29 05:09:43 +0000
commit7a1e12675ec5f1ea605d4de06a0b82079073fb20 (patch)
treee7389f14c03af4a0b4e70cda4b84cc6216144393 /IkiWiki
parent890257521ebb39dea0630143e60594d577128f1c (diff)
* Add --timeformat config option to allow changing how dates are displayed.
Note that as a side effect, dates will now be displayed using the local timezone, not as GMT.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/inline.pm2
-rw-r--r--IkiWiki/Render.pm14
2 files changed, 14 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 8b67bfa61..6ecdf0d38 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -62,7 +62,7 @@ sub preprocess_inline (@) { #{{{
$template->param(pagelink => htmllink($params{page}, $params{page}, $page));
$template->param(content => get_inline_content($params{page}, $page))
if $params{archive} eq "no";
- $template->param(ctime => scalar(gmtime($pagectime{$page})));
+ $template->param(ctime => displaytime($pagectime{$page}));
$ret.=$template->output;
}
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index df08eb49c..c5922c933 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -202,7 +202,7 @@ sub genpage ($$$) { #{{{
parentlinks => [parentlinks($page)],
content => $content,
backlinks => [backlinks($page)],
- mtime => scalar(gmtime($mtime)),
+ mtime => displaytime($mtime),
styleurl => styleurl($page),
);
@@ -223,6 +223,18 @@ sub check_overwrite ($$) { #{{{
}
} #}}}
+sub displaytime ($) { #{{{
+ my $time=shift;
+
+ if ($config{timeformat} eq '%c') {
+ return scalar(localtime($time)); # optimisation
+ }
+ else {
+ eval q{use POSIX};
+ return POSIX::strftime($config{timeformat}, localtime($time));
+ }
+} #}}}
+
sub mtime ($) { #{{{
my $file=shift;