summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/underlay.pm
blob: 3ea19c63519bdecf6cd7331d21d722b3e0bc72de (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. example => ["$ENV{HOME}/wiki.underlay"],
  22. description => "extra underlay directories to add",
  23. advanced => 1,
  24. safe => 0,
  25. rebuild => 1,
  26. },
  27. }
  28. sub checkconfig () {
  29. if ($config{add_underlays}) {
  30. foreach my $dir (@{$config{add_underlays}}) {
  31. add_underlay($dir);
  32. }
  33. }
  34. }
  35. 1;