X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/b74b7ab68b983b3f7d9e561eb991b21764cdb3be..95b3bbbf7c786cc9e1dd7d7925ac75a0f525affd:/IkiWiki/Plugin/prettydate.pm diff --git a/IkiWiki/Plugin/prettydate.pm b/IkiWiki/Plugin/prettydate.pm index be7e2c761..501f17f5d 100644 --- a/IkiWiki/Plugin/prettydate.pm +++ b/IkiWiki/Plugin/prettydate.pm @@ -39,30 +39,34 @@ sub default_timetable { ]; } -sub import { #{{{ - hook(type => "getsetup", id => "getsetup", call => \&getsetup); +sub import { + hook(type => "getsetup", id => "prettydate", call => \&getsetup); hook(type => "checkconfig", id => "prettydate", call => \&checkconfig); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return + plugin => { + safe => 1, + rebuild => 1, + }, prettydateformat => { type => "string", - default => '%X, %B %o, %Y', + example => '%X, %B %o, %Y', description => "format to use to display date", + advanced => 1, safe => 1, rebuild => 1, }, timetable => { - type => undef, # don't try to show in interface - default => '%X, %B %o, %Y', + type => "internal", description => "array of time descriptions", safe => 1, rebuild => 1, }, -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if (! defined $config{prettydateformat} || $config{prettydateformat} eq '%c') { $config{prettydateformat}='%X, %B %o, %Y'; @@ -78,9 +82,9 @@ sub checkconfig () { #{{{ $config{timetable}[$h] = $config{timetable}[$h - 1]; } } -} #}}} +} -sub IkiWiki::displaytime ($;$) { #{{{ +sub IkiWiki::formattime ($;$) { my $time=shift; my $format=shift; if (! defined $format) { @@ -118,6 +122,6 @@ sub IkiWiki::displaytime ($;$) { #{{{ $format=~s/\%X/$t/g; return strftime($format, \@t); -} #}}} +} 1