* inline: Add timeformat parameter to control how the ctime of

inlined pages is displayed. Closes: #451019
master
Joey Hess 2007-11-13 16:14:48 -05:00
parent 426d94b500
commit 264a82a435
6 changed files with 18 additions and 8 deletions

View File

@ -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 ($) { #{{{

View File

@ -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};

4
debian/changelog vendored
View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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 ""