From 2b569f99d9e7f1d4d30c7f3adde9729ff4d868cf Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 19 Oct 2008 19:13:40 -0400 Subject: fix relativedate timezone inclusion The machine parseable date needs to include a timezone. Also, simplified the interface for date display. --- po/ikiwiki.pot | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'po/ikiwiki.pot') diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 4dc12b20d..89cca9ff4 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: 2008-10-17 21:55-0400\n" +"POT-Creation-Date: 2008-10-19 19:13-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -48,7 +48,7 @@ msgstr "" msgid "You are banned." msgstr "" -#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1167 +#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1173 msgid "Error" msgstr "" @@ -89,7 +89,7 @@ msgstr "" #: ../IkiWiki/Plugin/aggregate.pm:463 #, perl-format -msgid "processed ok at %s" +msgid "last checked %s" msgstr "" #: ../IkiWiki/Plugin/aggregate.pm:467 @@ -172,9 +172,9 @@ msgid "automatic index generation" msgstr "" #: ../IkiWiki/Plugin/brokenlinks.pm:33 ../IkiWiki/Plugin/editpage.pm:261 -#: ../IkiWiki/Plugin/inline.pm:329 ../IkiWiki/Plugin/opendiscussion.pm:26 +#: ../IkiWiki/Plugin/inline.pm:327 ../IkiWiki/Plugin/opendiscussion.pm:26 #: ../IkiWiki/Plugin/orphans.pm:37 ../IkiWiki/Render.pm:79 -#: ../IkiWiki/Render.pm:151 +#: ../IkiWiki/Render.pm:149 msgid "discussion" msgstr "" @@ -318,11 +318,11 @@ msgstr "" msgid "nonexistant template %s" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:337 ../IkiWiki/Render.pm:83 +#: ../IkiWiki/Plugin/inline.pm:335 ../IkiWiki/Render.pm:83 msgid "Discussion" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:574 +#: ../IkiWiki/Plugin/inline.pm:572 msgid "RPC::XML::Client not found, not pinging" msgstr "" @@ -780,59 +780,59 @@ msgstr "" msgid "

Error: %s exited nonzero (%s)" msgstr "" -#: ../IkiWiki/Render.pm:255 +#: ../IkiWiki/Render.pm:253 #, perl-format msgid "" "symlink found in srcdir path (%s) -- set allow_symlinks_before_srcdir to " "allow this" msgstr "" -#: ../IkiWiki/Render.pm:279 ../IkiWiki/Render.pm:304 +#: ../IkiWiki/Render.pm:277 ../IkiWiki/Render.pm:302 #, perl-format msgid "skipping bad filename %s" msgstr "" -#: ../IkiWiki/Render.pm:286 +#: ../IkiWiki/Render.pm:284 #, perl-format msgid "%s has multiple possible source pages" msgstr "" -#: ../IkiWiki/Render.pm:362 +#: ../IkiWiki/Render.pm:360 #, perl-format msgid "removing old page %s" msgstr "" -#: ../IkiWiki/Render.pm:402 +#: ../IkiWiki/Render.pm:400 #, perl-format msgid "scanning %s" msgstr "" -#: ../IkiWiki/Render.pm:407 +#: ../IkiWiki/Render.pm:405 #, perl-format msgid "rendering %s" msgstr "" -#: ../IkiWiki/Render.pm:428 +#: ../IkiWiki/Render.pm:426 #, perl-format msgid "rendering %s, which links to %s" msgstr "" -#: ../IkiWiki/Render.pm:449 +#: ../IkiWiki/Render.pm:447 #, perl-format msgid "rendering %s, which depends on %s" msgstr "" -#: ../IkiWiki/Render.pm:488 +#: ../IkiWiki/Render.pm:486 #, perl-format msgid "rendering %s, to update its backlinks" msgstr "" -#: ../IkiWiki/Render.pm:500 +#: ../IkiWiki/Render.pm:498 #, perl-format msgid "removing %s, no longer rendered by %s" msgstr "" -#: ../IkiWiki/Render.pm:524 +#: ../IkiWiki/Render.pm:522 #, perl-format msgid "ikiwiki: cannot render %s" msgstr "" @@ -926,12 +926,12 @@ msgstr "" msgid "failed to load external plugin needed for %s plugin: %s" msgstr "" -#: ../IkiWiki.pm:1150 +#: ../IkiWiki.pm:1156 #, perl-format msgid "preprocessing loop detected on %s at depth %i" msgstr "" -#: ../IkiWiki.pm:1659 +#: ../IkiWiki.pm:1665 msgid "yes" msgstr "" -- cgit v1.2.3 From fd9393ef8575ad4a8966ae7f5310aab688dedf48 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 19 Oct 2008 20:12:37 -0400 Subject: 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. --- IkiWiki.pm | 17 ++++++++++++++--- IkiWiki/Plugin/relativedate.pm | 3 ++- doc/plugins/write.mdwn | 8 +++++++- po/ikiwiki.pot | 8 ++++---- 4 files changed, 27 insertions(+), 9 deletions(-) (limited to 'po/ikiwiki.pot') 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) { diff --git a/IkiWiki/Plugin/relativedate.pm b/IkiWiki/Plugin/relativedate.pm index 0c9426dda..d9d8f7776 100644 --- a/IkiWiki/Plugin/relativedate.pm +++ b/IkiWiki/Plugin/relativedate.pm @@ -12,6 +12,7 @@ sub import { #{{{ 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 () { #{{{ @@ -42,7 +43,7 @@ sub include_javascript ($;$) { #{{{ '" type="text/javascript" charset="utf-8">'; } #}}} -sub IkiWiki::displaytime ($;$) { #{{{ +sub display ($;$) { #{{{ my $time=shift; my $format=shift; diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index daf70c8e2..856b34ba1 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -196,7 +196,6 @@ generating the page. 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 @@ -361,6 +360,13 @@ This hook is called whenever ikiwiki normally saves its state, just before 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); diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 89cca9ff4..335575f02 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: 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 \n" "Language-Team: LANGUAGE \n" @@ -48,7 +48,7 @@ msgstr "" 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 "" @@ -926,12 +926,12 @@ 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 "" -- cgit v1.2.3