]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - 1.33.2/IkiWiki/Plugin/ddate.pm
tagging version 1.33.2
[git.ikiwiki.info.git] / 1.33.2 / 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;
7 sub import { #{{{
8         hook(type => "checkconfig", id => "skeleton", call => \&checkconfig);
9 } # }}}
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 } #}}}
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 } #}}}
32 5