* 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; return $ret;
} #}}} } #}}}
sub displaytime ($) { #{{{ sub displaytime ($;$) { #{{{
my $time=shift; my $time=shift;
my $format=shift;
if (! defined $format) {
$format=$config{timeformat};
}
# strftime doesn't know about encodings, so make sure # strftime doesn't know about encodings, so make sure
# its output is properly treated as utf8 # its output is properly treated as utf8
return decode_utf8(POSIX::strftime( return decode_utf8(POSIX::strftime($format, localtime($time)));
$config{timeformat}, localtime($time)));
} #}}} } #}}}
sub beautify_url ($) { #{{{ sub beautify_url ($) { #{{{

View File

@ -221,7 +221,7 @@ sub preprocess_inline (@) { #{{{
} }
$template->param(pageurl => urlto(bestlink($params{page}, $page), $params{destpage})); $template->param(pageurl => urlto(bestlink($params{page}, $page), $params{destpage}));
$template->param(title => pagetitle(basename($page))); $template->param(title => pagetitle(basename($page)));
$template->param(ctime => displaytime($pagectime{$page})); $template->param(ctime => displaytime($pagectime{$page}, $params{timeformat}));
if ($actions) { if ($actions) {
my $file = $pagesources{$page}; 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, * Add liblwpx-paranoidagent-perl to recommends of Debian package,
this is needed to do OpenID really securely. this is needed to do OpenID really securely.
* ikiwiki.setup is licensed same as the basewiki, not GPLed. * 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 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. 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 * `feedonly` - Only generate the feed, do not display the pages inline on
the page. 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 If the directory name is not absolute, ikiwiki will assume it is in
the parent directory of the configured underlaydir. the parent directory of the configured underlaydir.
#### `displaytime($)` #### `displaytime($;$)`
Given a time, formats it for display. Given a time, formats it for display.
The optional second parameter is a strftime format to use to format the
time.
#### `gettext` #### `gettext`
This is the standard gettext function, although slightly optimised. This is the standard gettext function, although slightly optimised.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -614,7 +614,7 @@ msgstr ""
#. translators: preprocessor directive name, #. translators: preprocessor directive name,
#. translators: the second a page name, the #. translators: the second a page name, the
#. translators: third a number. #. translators: third a number.
#: ../IkiWiki.pm:708 #: ../IkiWiki.pm:711
#, perl-format #, perl-format
msgid "%s preprocessing loop detected on %s at depth %i" msgid "%s preprocessing loop detected on %s at depth %i"
msgstr "" msgstr ""