add paths to plugin files in copyright
[ikiwiki.git] / IkiWiki / Plugin / ddate.pm
blobbb77ce59f267a5c9e541a1f42f88d6eca0eee4f1
1 #!/usr/bin/perl
2 # Discordian date support fnord ikiwiki.
3 package IkiWiki::Plugin::ddate;
5 use IkiWiki 3.00;
6 no warnings;
8 sub import {
9 hook(type => "getsetup", id => "ddate", call => \&getsetup);
12 sub getsetup {
13 return
14 plugin => {
15 safe => 1,
16 rebuild => 1,
20 sub IkiWiki::formattime ($;$) {
21 my $time=shift;
22 my $format=shift;
23 if (! defined $format) {
24 $format=$config{timeformat};
25 if ($format eq '%c') {
26 $format='on %A, the %e of %B, %Y. %N%nCelebrate %H';
29 eval q{
30 use DateTime;
31 use DateTime::Calendar::Discordian;
33 if ($@) {
34 return "some time or other ($@ -- hail Eris!)";
36 my $dt = DateTime->from_epoch(epoch => $time);
37 my $dd = DateTime::Calendar::Discordian->from_object(object => $dt);
38 return $dd->strftime($format);