aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/theme.pm
blob: ba6966381d6da42e646b9fe785b9e0e86b4f50a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl
package IkiWiki::Plugin::theme;

use warnings;
use strict;
use IkiWiki 3.00;

sub import {
	hook(type => "getsetup", id => "theme", call => \&getsetup);
	hook(type => "checkconfig", id => "theme", call => \&checkconfig);
}

sub getsetup () {
	return
		plugin => {
			safe => 1,
			rebuild => 0,
			section => "web",
		},
		theme => {
			type => "string",
			example => "actiontabs",
			description => "name of theme to enable",
			safe => 1,
			rebuild => 1,
		},
}

my $added=0;
sub checkconfig () {
	if (! $added && exists $config{theme} && $config{theme} =~ /^\w+$/) {
		add_underlay("themes/".$config{theme});
		$added=1;
	}
}

1