summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/underlay.pm
blob: 380d418fba9919b3023e391bed3237406424f76a (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. }
  28. sub checkconfig () {
  29. return unless exists $config{add_underlays};
  30. foreach my $dir (@{$config{add_underlays}}) {
  31. add_underlay($dir);
  32. }
  33. }
  34. 1;