<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
# Discordian date support fnord ikiwiki.
package IkiWiki::Plugin::ddate;

use IkiWiki 2.00;
no warnings;

sub import { #{{{
	hook(type =&gt; "getsetup", id =&gt; "ddate", call =&gt; \&amp;getsetup);
} # }}}

sub getsetup { #{{{
	return
		plugin =&gt; {
			safe =&gt; 1,
			rebuild =&gt; 1,
		},
} #}}}

sub IkiWiki::formattime ($;$) { #{{{
	my $time=shift;
	my $format=shift;
	if (! defined $format) {
		$format=$config{timeformat};
		if ($format eq '%c') {
			$format='on %A, the %e of %B, %Y. %N%nCelebrate %H';
		}
	}
	eval q{
		use DateTime;
		use DateTime::Calendar::Discordian;
	};
	if ($@) {
		 return "some time or other ($@ -- hail Eris!)";
	}
	my $dt = DateTime-&gt;from_epoch(epoch =&gt; $time);
	my $dd = DateTime::Calendar::Discordian-&gt;from_object(object =&gt; $dt);
	return $dd-&gt;strftime($format);
} #}}}

5
</pre></body></html>