summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/opendiscussion.pm
blob: 3da01efee154988d1432d0ed54680525569e224c (plain)
  1. #!/usr/bin/perl
  2. package IkiWiki::Plugin::opendiscussion;
  3. use warnings;
  4. use strict;
  5. use IkiWiki 3.00;
  6. sub import {
  7. hook(type => "getsetup", id => "opendiscussion", call => \&getsetup);
  8. hook(type => "canedit", id => "opendiscussion", call => \&canedit);
  9. }
  10. sub getsetup () {
  11. return
  12. plugin => {
  13. safe => 1,
  14. rebuild => 0,
  15. },
  16. }
  17. sub canedit ($$) {
  18. my $page=shift;
  19. my $cgi=shift;
  20. my $session=shift;
  21. my $discussion=gettext("discussion");
  22. return "" if $page=~/(\/|^)\Q$discussion\E$/;
  23. return undef;
  24. }
  25. 1