summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/theme.pm
blob: ba6966381d6da42e646b9fe785b9e0e86b4f50a2 (plain)
  1. #!/usr/bin/perl
  2. package IkiWiki::Plugin::theme;
  3. use warnings;
  4. use strict;
  5. use IkiWiki 3.00;
  6. sub import {
  7. hook(type => "getsetup", id => "theme", call => \&getsetup);
  8. hook(type => "checkconfig", id => "theme", call => \&checkconfig);
  9. }
  10. sub getsetup () {
  11. return
  12. plugin => {
  13. safe => 1,
  14. rebuild => 0,
  15. section => "web",
  16. },
  17. theme => {
  18. type => "string",
  19. example => "actiontabs",
  20. description => "name of theme to enable",
  21. safe => 1,
  22. rebuild => 1,
  23. },
  24. }
  25. my $added=0;
  26. sub checkconfig () {
  27. if (! $added && exists $config{theme} && $config{theme} =~ /^\w+$/) {
  28. add_underlay("themes/".$config{theme});
  29. $added=1;
  30. }
  31. }
  32. 1