add theme plugin

master
Joey Hess 2010-06-16 15:43:42 -04:00
parent a748f283ac
commit 062ed44f47
7 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,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 => 0,
},
}
my $added=0;
sub checkconfig () {
if (! $added && exists $config{theme} && $config{theme} =~ /^\w+$/) {
add_underlay("themes/".$config{theme});
$added=1;
}
}
1

View File

@ -79,6 +79,18 @@ underlay_install:
fi \
done
# Themes have their style.css appended to the normal one.
for theme in themes/*; do \
install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme; \
for file in $$theme/*; do \
if echo "$$file" | grep -q style.css; then \
(cat doc/style.css; cat $$file) >> $(DESTDIR)$(PREFIX)/share/ikiwiki/$$theme/style.css; \
elif [ -f "$$file" ]; then \
install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/$$file; \
fi \
done; \
done
extra_install: underlay_install
# Install example sites.
for dir in `cd doc/examples; find . -type d ! -regex '.*\.svn.*'`; do \

1
debian/changelog vendored
View File

@ -22,6 +22,7 @@ ikiwiki (3.20100611) UNRELEASED; urgency=low
* git: Gix --gettime to properly support utf8 filenames.
* attachment: Support Windows paths when taking basename of client-supplied
file name.
* theme: New plugin, allows easily theming a site via the underlay.
-- Joey Hess <joeyh@debian.org> Fri, 11 Jun 2010 13:39:15 -0400

View File

@ -0,0 +1,11 @@
[[!template id=plugin name=theme author="[[Joey]]"]]
[[!tag type/web]]
The theme plugin allows easily applying a theme to your wiki, by
configuring the `theme` setting in the setup file with the name of a theme
to use. The themes you can choose from are all subdirectories, typically
inside `/usr/share/ikiwiki/themes/`.
A theme provides, via the underlay, an enhanced version of the regular
[[style.css]]. This leaves [[local.css]] free for you to further
customise. Themes can also provide header and background images.

View File

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 165 B