summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/opendiscussion.pm
blob: 95220d7b3ed39598ce0760fbdecc374b7f2c59ae (plain)
  1. #!/usr/bin/perl
  2. package IkiWiki::Plugin::opendiscussion;
  3. use warnings;
  4. use strict;
  5. use IkiWiki 2.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