aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Plugin/theme.pm37
-rwxr-xr-xMakefile.PL14
-rw-r--r--debian/changelog1
-rw-r--r--doc/plugins/theme.pm11
-rw-r--r--themes/actiontabs/style.css (renamed from underlays/themes/actiontabs/style.css)0
-rw-r--r--themes/bzed/background_darkness.png (renamed from underlays/themes/bzed/background_darkness.png)bin165 -> 165 bytes
-rw-r--r--themes/bzed/style.css (renamed from underlays/themes/bzed/style.css)0
7 files changed, 62 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/theme.pm b/IkiWiki/Plugin/theme.pm
new file mode 100644
index 000000000..5e6e4b092
--- /dev/null
+++ b/IkiWiki/Plugin/theme.pm
@@ -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
diff --git a/Makefile.PL b/Makefile.PL
index 4001c841b..29ec9c209 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -78,7 +78,19 @@ underlay_install:
install -m 644 $$file $(DESTDIR)$(PREFIX)/share/ikiwiki/directives/ikiwiki/directive; \
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 \
diff --git a/debian/changelog b/debian/changelog
index 1f350912e..0d49df676 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/doc/plugins/theme.pm b/doc/plugins/theme.pm
new file mode 100644
index 000000000..7149cc163
--- /dev/null
+++ b/doc/plugins/theme.pm
@@ -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.
diff --git a/underlays/themes/actiontabs/style.css b/themes/actiontabs/style.css
index f48448e2e..f48448e2e 100644
--- a/underlays/themes/actiontabs/style.css
+++ b/themes/actiontabs/style.css
diff --git a/underlays/themes/bzed/background_darkness.png b/themes/bzed/background_darkness.png
index 0a1cb4e9e..0a1cb4e9e 100644
--- a/underlays/themes/bzed/background_darkness.png
+++ b/themes/bzed/background_darkness.png
Binary files differ
diff --git a/underlays/themes/bzed/style.css b/themes/bzed/style.css
index 540cac415..540cac415 100644
--- a/underlays/themes/bzed/style.css
+++ b/themes/bzed/style.css