]> sipb.mit.edu Git - ikiwiki.git/blob - IkiWiki/Plugin/ddate.pm
remove dead code
[ikiwiki.git] / IkiWiki / Plugin / ddate.pm
1 #!/usr/bin/perl
2 # Discordian date support fnord ikiwiki.
3 package IkiWiki::Plugin::ddate;
4
5 use IkiWiki 2.00;
6 no warnings;
7
8 sub import { #{{{
9         hook(type => "getsetup", id => "ddate", call => \&getsetup);
10         hook(type => "checkconfig", id => "ddate", call => \&checkconfig);
11 } # }}}
12
13 sub getsetup { #{{{
14         return
15                 plugin => {
16                         safe => 1,
17                         rebuild => 1,
18                 },
19 } #}}}
20
21 sub checkconfig () { #{{{
22         if (! defined $config{timeformat} ||
23             $config{timeformat} eq '%c') {
24                 $config{timeformat}='on %A, the %e of %B, %Y. %N%nCelebrate %H';
25         }
26 } #}}}
27
28 sub IkiWiki::displaytime ($;$) { #{{{
29         my $time=shift;
30         my $format=shift;
31         if (! defined $format) {
32                 $format=$config{timeformat};
33         }
34         eval q{
35                 use DateTime;
36                 use DateTime::Calendar::Discordian;
37         };
38         if ($@) {
39                  return "some time or other ($@ -- hail Eris!)";
40         }
41         my $dt = DateTime->from_epoch(epoch => $time);
42         my $dd = DateTime::Calendar::Discordian->from_object(object => $dt);
43         return $dd->strftime($format);
44 } #}}}
45
46 5