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