ikiwiki/IkiWiki/Plugin/ddate.pm

33 lines
811 B
Perl
Raw Normal View History

2006-08-27 05:55:45 +02:00
#!/usr/bin/perl
# Discordian date support fnord ikiwiki.
package IkiWiki::Plugin::ddate;
use IkiWiki;
2006-08-27 06:04:59 +02:00
use IkiWiki::Render; # so we can redefine it here
2006-08-27 05:55:45 +02:00
no warnings;
sub import { #{{{
IkiWiki::hook(type => "checkconfig", id => "skeleton",
call => \&checkconfig);
} # }}}
sub checkconfig () { #{{{
if (! defined $IkiWiki::config{timeformat} ||
$IkiWiki::config{timeformat} eq '%c') {
$IkiWiki::config{timeformat}='on %{%A, the %e of %B%}, %Y. %N%nCelebrate %H';
}
} #}}}
sub IkiWiki::displaytime ($) { #{{{
my $time=shift;
eval q{use POSIX};
my $gregorian=POSIX::strftime("%d %m %Y", localtime($time));
my $date=`ddate +'$IkiWiki::config{timeformat}' $gregorian`;
chomp $date;
2006-08-27 06:14:41 +02:00
if ($? || ! length $date) {
return "some time or other (hail Eris!)";
}
2006-08-27 05:55:45 +02:00
return $date;
} #}}}
5