} #}}}
sub displaytime ($;$) { #{{{
- # Plugins can override this function to mark up the time for
- # display.
- return formattime(@_);
+ my $time=shift;
+ my $format=shift;
+ if (exists $hooks{displaytime}) {
+ my $ret;
+ run_hooks(displaytime => sub {
+ $ret=shift->($time, $format)
+ });
+ return $ret;
+ }
+ else {
+ return formattime($time, $format);
+ }
} #}}}
sub formattime ($;$) { #{{{
+ # Plugins can override this function to mark up the time for
+ # display.
my $time=shift;
my $format=shift;
if (! defined $format) {
add_underlay("javascript");
hook(type => "getsetup", id => "relativedate", call => \&getsetup);
hook(type => "format", id => "relativedate", call => \&format);
+ hook(type => "displaytime", id => "relativedate", call => \&display);
} # }}}
sub getsetup () { #{{{
'" type="text/javascript" charset="utf-8"></script>';
} #}}}
-sub IkiWiki::displaytime ($;$) { #{{{
+sub display ($;$) { #{{{
my $time=shift;
my $format=shift;
hook(type => "pagetemplate", id => "foo", call => \&pagetemplate);
-
[[Templates|wikitemplates]] are filled out for many different things in
ikiwiki, like generating a page, or part of a blog page, or an rss feed, or
a cgi. This hook allows modifying the variables available on those
the state is saved. The function can save other state, modify values before
they're saved, etc.
+### displaytime
+
+ hook(type => "displaytime", id => "foo", call => \&display);
+
+This hook can be registered to override the regular `displaytime` function.
+Only the last displaytime hook will be used.
+
### renamepage
hook(type => "renamepage", id => "foo", call => \&renamepage);
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-10-19 19:13-0400\n"
+"POT-Creation-Date: 2008-10-19 20:06-0400\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"
msgid "You are banned."
msgstr ""
-#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1173
+#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1182
msgid "Error"
msgstr ""
msgid "failed to load external plugin needed for %s plugin: %s"
msgstr ""
-#: ../IkiWiki.pm:1156
+#: ../IkiWiki.pm:1165
#, perl-format
msgid "preprocessing loop detected on %s at depth %i"
msgstr ""
-#: ../IkiWiki.pm:1665
+#: ../IkiWiki.pm:1674
msgid "yes"
msgstr ""