summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/ddate.pm
blob: b677026558f457f8da0e48c605006771361eb905 (plain)
  1. #!/usr/bin/perl
  2. # Discordian date support fnord ikiwiki.
  3. package IkiWiki::Plugin::ddate;
  4. use IkiWiki;
  5. no warnings;
  6. sub import { #{{{
  7. hook(type => "checkconfig", id => "skeleton", call => \&checkconfig);
  8. } # }}}
  9. sub checkconfig () { #{{{
  10. if (! defined $config{timeformat} ||
  11. $config{timeformat} eq '%c') {
  12. $config{timeformat}='on %{%A, the %e of %B%}, %Y. %N%nCelebrate %H';
  13. }
  14. } #}}}
  15. sub IkiWiki::displaytime ($) { #{{{
  16. my $time=shift;
  17. eval q{use POSIX};
  18. my $gregorian=POSIX::strftime("%d %m %Y", localtime($time));
  19. my $date=`ddate +'$config{timeformat}' $gregorian`;
  20. chomp $date;
  21. if ($? || ! length $date) {
  22. return "some time or other (hail Eris!)";
  23. }
  24. return $date;
  25. } #}}}
  26. 5