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