summaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-10-19 20:12:37 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-10-19 20:12:37 -0400
commitfd9393ef8575ad4a8966ae7f5310aab688dedf48 (patch)
tree6854fa55eb8ce4c703c48da585ba372d0f17ab2e /IkiWiki.pm
parent3bdc66d30045a7259a7a71173fc6ce85b17cfaf6 (diff)
add displaytime hook
Need to use a hook because an exported function cannot be reliably overridden. The replacement verstion was actually only affecting plugins loaded after it. formattime doesn't need a hook, since there's no reason to export it.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm17
1 files changed, 14 insertions, 3 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 1f4d40d41..207ca87fb 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -898,12 +898,23 @@ sub abs2rel ($$) { #{{{
} #}}}
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) {