]> sipb.mit.edu Git - ikiwiki.git/blob - IkiWiki/Plugin/ddate.pm
3bd6c6f73365bca9eb0719c5b15a0c133f7f7db7
[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 use IkiWiki::Render; # so we can redefine it here
6 no warnings;
7
8 sub import { #{{{
9         IkiWiki::hook(type => "checkconfig", id => "skeleton", 
10                 call => \&checkconfig);
11 } # }}}
12
13 sub checkconfig () { #{{{
14         if (! defined $IkiWiki::config{timeformat} ||
15             $IkiWiki::config{timeformat} eq '%c') {
16                 $IkiWiki::config{timeformat}='on %{%A, the %e of %B%}, %Y. %N%nCelebrate %H';
17         }
18 } #}}}
19
20 sub IkiWiki::displaytime ($) { #{{{
21         my $time=shift;
22         eval q{use POSIX};
23         my $gregorian=POSIX::strftime("%d %m %Y", localtime($time));
24         my $date=`ddate +'$IkiWiki::config{timeformat}' $gregorian`;
25         chomp $date;
26         return $date;
27 } #}}}
28
29 5