diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2007-11-13 16:14:48 -0500 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2007-11-13 16:14:48 -0500 |
commit | 264a82a435b9ce5560f4bbea7b53270c53ef5720 (patch) | |
tree | 3f48689d2bed7cfbd9e198ecf10a1c7788f70ed1 | |
parent | 426d94b5007b3792a72ba4394e41b12e874d8203 (diff) |
* inline: Add timeformat parameter to control how the ctime of
inlined pages is displayed. Closes: #451019
-rw-r--r-- | IkiWiki.pm | 9 | ||||
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 2 | ||||
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | doc/blog.mdwn | 2 | ||||
-rw-r--r-- | doc/plugins/write.mdwn | 5 | ||||
-rw-r--r-- | po/ikiwiki.pot | 4 |
6 files changed, 18 insertions, 8 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 5ae360ad0..ad4d26741 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -498,13 +498,16 @@ sub abs2rel ($$) { #{{{ return $ret; } #}}} -sub displaytime ($) { #{{{ +sub displaytime ($;$) { #{{{ my $time=shift; + my $format=shift; + if (! defined $format) { + $format=$config{timeformat}; + } # strftime doesn't know about encodings, so make sure # its output is properly treated as utf8 - return decode_utf8(POSIX::strftime( - $config{timeformat}, localtime($time))); + return decode_utf8(POSIX::strftime($format, localtime($time))); } #}}} sub beautify_url ($) { #{{{ diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index bb160ac4d..ebeb23178 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -221,7 +221,7 @@ sub preprocess_inline (@) { #{{{ } $template->param(pageurl => urlto(bestlink($params{page}, $page), $params{destpage})); $template->param(title => pagetitle(basename($page))); - $template->param(ctime => displaytime($pagectime{$page})); + $template->param(ctime => displaytime($pagectime{$page}, $params{timeformat})); if ($actions) { my $file = $pagesources{$page}; diff --git a/debian/changelog b/debian/changelog index 3f809a7e0..749db67e0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,10 @@ ikiwiki (2.13) UNRELEASED; urgency=low * Add liblwpx-paranoidagent-perl to recommends of Debian package, this is needed to do OpenID really securely. * ikiwiki.setup is licensed same as the basewiki, not GPLed. + * inline: Add timeformat parameter to control how the ctime of + inlined pages is displayed. Closes: #451019 - -- Joey Hess <joeyh@debian.org> Tue, 13 Nov 2007 16:03:46 -0500 + -- Joey Hess <joeyh@debian.org> Tue, 13 Nov 2007 16:11:54 -0500 ikiwiki (2.12) unstable; urgency=low diff --git a/doc/blog.mdwn b/doc/blog.mdwn index fe839775c..6e5eec4aa 100644 --- a/doc/blog.mdwn +++ b/doc/blog.mdwn @@ -93,3 +93,5 @@ directive: the rss/atom feeds. The default is the same as the `show` value above. * `feedonly` - Only generate the feed, do not display the pages inline on the page. +* `timeformat` - Use this to specify how to display the time or date for pages + in the blog. The format string is passed to the strftime(3) function. diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 0e1839c6c..64b353a41 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -477,10 +477,13 @@ search for files. If the directory name is not absolute, ikiwiki will assume it is in the parent directory of the configured underlaydir. -#### `displaytime($)` +#### `displaytime($;$)` Given a time, formats it for display. +The optional second parameter is a strftime format to use to format the +time. + #### `gettext` This is the standard gettext function, although slightly optimised. diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 2a3fef4c5..3448cda19 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-11-12 14:36-0500\n" +"POT-Creation-Date: 2007-11-13 16:14-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -614,7 +614,7 @@ msgstr "" #. translators: preprocessor directive name, #. translators: the second a page name, the #. translators: third a number. -#: ../IkiWiki.pm:708 +#: ../IkiWiki.pm:711 #, perl-format msgid "%s preprocessing loop detected on %s at depth %i" msgstr "" |