summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/underlay.pm
blob: 116fe7324e5d3b4a770acd6876067eb020cf4ae8 (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. add_templates => {
  28. type => "string",
  29. example => ["$ENV{HOME}/.ikiwiki/templates"],
  30. description => "extra template directories to add",
  31. advanced => 1,
  32. safe => 0,
  33. rebuild => 1,
  34. },
  35. }
  36. sub checkconfig () {
  37. if ($config{add_underlays}) {
  38. foreach my $dir (@{$config{add_underlays}}) {
  39. add_underlay($dir);
  40. }
  41. }
  42. if ($config{add_templates}) {
  43. push @{$config{templatedirs}}, @{$config{add_templates}};
  44. }
  45. }
  46. 1;