]> sipb.mit.edu Git - ikiwiki.git/blob - IkiWiki/Plugin/ddate.pm
* Add openidsignup config option.
[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{
21                 use DateTime;
22                 use DateTime::Calendar::Discordian;
23         };
24         if ($@) {
25                  return "some time or other ($@ -- hail Eris!)";
26         }
27         my $dt = DateTime->from_epoch(epoch => $time);
28         my $dd = DateTime::Calendar::Discordian->from_object(object => $dt);
29         return $dd->strftime($IkiWiki::config{timeformat});
30 } #}}}
31
32 5