2 package IkiWiki
::Plugin
::theme
;
9 hook
(type
=> "getsetup", id
=> "theme", call
=> \
&getsetup
);
10 hook
(type
=> "checkconfig", id
=> "theme", call
=> \
&checkconfig
);
11 hook
(type
=> "needsbuild", id
=> "theme", call
=> \
&needsbuild
);
23 example
=> "actiontabs",
24 description
=> "name of theme to enable",
32 if (! $added && exists $config{theme
} && $config{theme
} =~ /^\w+$/) {
33 add_underlay
("themes/".$config{theme
});
40 if (($config{theme
} || '') ne ($wikistate{theme
}{currenttheme
} || '')) {
41 # theme changed; ensure all files in the theme are built
42 my %needsbuild=map { $_ => 1 } @
$needsbuild;
44 foreach my $file (glob("$config{underlaydirbase}/themes/$config{theme}/*")) {
46 my $f=IkiWiki
::basename
($file);
48 unless $needsbuild{$f};
52 elsif ($wikistate{theme
}{currenttheme
}) {
53 foreach my $file (glob("$config{underlaydirbase}/themes/$wikistate{theme}{currenttheme}/*")) {
54 my $f=IkiWiki
::basename
($file);
55 if (-f
$file && defined eval { srcfile
($f) }) {
56 push @
$needsbuild, $f;
61 $wikistate{theme
}{currenttheme
}=$config{theme
};