summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/underlay.pm
blob: c599356728e39dddcf729f62cbe5e78ada939f50 (plain)
  1. #!/usr/bin/perl
  2. package IkiWiki::Plugin::underlay;
  3. # Copyright © 2008 Simon McVittie <http://smcv.pseudorandom.co.uk/>
  4. # Licensed under the GNU GPL, version 2, or any later version published by the
  5. # Free Software Foundation
  6. use warnings;
  7. use strict;
  8. use IkiWiki 3.00;
  9. sub import {
  10. hook(type => "getsetup", id => "underlay", call => \&getsetup);
  11. hook(type => "checkconfig", id => "underlay", call => \&checkconfig);
  12. }
  13. sub getsetup () {
  14. return
  15. plugin => {
  16. safe => 0,
  17. rebuild => undef,
  18. },
  19. add_underlays => {
  20. type => "string",
  21. default => [],
  22. description => "extra underlay directories to add",
  23. advanced => 1,
  24. safe => 0,
  25. rebuild => 1,
  26. },
  27. add_templates => {
  28. type => "string",
  29. default => [],
  30. description => "extra template directories to add",
  31. advanced => 1,
  32. safe => 0,
  33. rebuild => 1,
  34. },
  35. }
  36. sub checkconfig () {
  37. foreach my $dir (@{$config{add_underlays}}) {
  38. add_underlay($dir);
  39. }
  40. push @{$config{templatedirs}}, @{$config{add_templates}};
  41. }
  42. 1;