]> sipb.mit.edu Git - ikiwiki.git/blob - IkiWiki/Plugin/ddate.pm
b677026558f457f8da0e48c605006771361eb905
[ikiwiki.git] / IkiWiki / Plugin / ddate.pm
1 #!/usr/bin/perl
2 # Discordian date support fnord ikiwiki.
3 package IkiWiki::Plugin::ddate;
4 use IkiWiki;
5 no warnings;
6
7 sub import { #{{{
8         hook(type => "checkconfig", id => "skeleton", call => \&checkconfig);
9 } # }}}
10
11 sub checkconfig () { #{{{
12         if (! defined $config{timeformat} ||
13             $config{timeformat} eq '%c') {
14                 $config{timeformat}='on %{%A, the %e of %B%}, %Y. %N%nCelebrate %H';
15         }
16 } #}}}
17
18 sub IkiWiki::displaytime ($) { #{{{
19         my $time=shift;
20         eval q{use POSIX};
21         my $gregorian=POSIX::strftime("%d %m %Y", localtime($time));
22         my $date=`ddate +'$config{timeformat}' $gregorian`;
23         chomp $date;
24         if ($? || ! length $date) {
25                 return "some time or other (hail Eris!)";
26         }
27         return $date;
28 } #}}}
29
30 5