From: Joey Hess Date: Wed, 16 Jun 2010 19:43:42 +0000 (-0400) Subject: add theme plugin X-Git-Tag: 3.20100623~47^2~3 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/062ed44f47d61c3bbbf2e8a7944a9b4e423b735a add theme plugin --- 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 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/themes/actiontabs/style.css b/themes/actiontabs/style.css new file mode 100644 index 000000000..f48448e2e --- /dev/null +++ b/themes/actiontabs/style.css @@ -0,0 +1,123 @@ +/* actiontabs theme for ikiwiki + * + * by svend + */ + +a { + text-decoration: none; + color: #005a9c; +} + +a:hover { + text-decoration: underline; +} + + +hr { + border-style: none; + background-color: #999; + height: 1px; +} + +code, pre { + background: #eee; +} + +pre { + padding: .5em; +} + +body { + margin: 0; + padding: 0; + font-family: sans-serif; + color: black; + background: white; +} + +.pageheader { + margin: 0; + padding: 1em 2em 0 2em; + background: #eee; + border-color: #999; + border-style: none none solid none; + border-width: 1px; +} + +.header { + font-size: 100%; + font-weight: normal; +} + +.title { + display: block; + margin-top: .2em; + font: 140% sans-serif; + text-transform: capitalize; +} + +.actions { + text-align: right; + padding: 0; +} + +#content, #comments, #footer { + margin: 1em 2em; +} + +#pageinfo { + border-color: #999; +} + +.inlinepage { + margin: .4em 0; + padding: .4em 0; + border-style: none; + border-top: 1px solid #aaa; +} + +.inlineheader { + font-size: 120%; + font-weight: normal; +} + +h1 { font: 120% sans-serif } +h2 { font: bold 100% sans-serif } +h3 { font: italic 100% sans-serif } +h4, h5, h6 { font: small-caps 100% sans-serif } + +/* Smaller headings for inline pages */ +.inlinepage h1 { font-size: 110% } +.inlinepage h2 { font-size: 100% } +.inlinepage h3 { font-size: 100% } + +.pageheader .actions ul { + border-style: none +} + +.actions ul { + font-size: 75%; + padding: 0; + border-style: none; +} + +.actions ul li a { + text-decoration: none; +} + +.actions ul li { + margin: 0; + padding: .1em .5em 0 .5em; + background: white; + border-color: #999; + border-style: solid solid none solid; + border-width: 1px; +} + +div.recentchanges { + border-style: none; +} + +.pagecloud { + width: auto; +} diff --git a/themes/bzed/background_darkness.png b/themes/bzed/background_darkness.png new file mode 100644 index 000000000..0a1cb4e9e Binary files /dev/null and b/themes/bzed/background_darkness.png differ diff --git a/themes/bzed/style.css b/themes/bzed/style.css new file mode 100644 index 000000000..540cac415 --- /dev/null +++ b/themes/bzed/style.css @@ -0,0 +1,280 @@ +/* bzed theme for ikiwiki + * + * Copyright (C) 2010 Bernd Zeimetz + * Licensed under same license as ikiwiki: GPL v2 or later + * + * Parts of this file are based on the awesome YUI, + * these parts will stay under the BSD license, + * but you're free to apply the GPLv2 to them, of course. + */ + + + +/* ------------------------------------------------------------------------------------------------- +Based on reset-fonts-grids.css from yui. +Copyright (c) 2008, Yahoo! Inc. All rights reserved. +Code licensed under the BSD License: +http://developer.yahoo.net/yui/license.txt +version: 2.5.1 +*/ +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,legend,p,blockquote,th,td{margin:0;padding:0;} +table{border-collapse:collapse;border-spacing:0;} +img{border:0;} +address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;} +li{list-style:none;} +caption,th{text-align:left;} +h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;} +q:before,q:after{content:'';} +abbr,acronym {border:0;font-variant:normal;} +sup {vertical-align:text-top;} +sub {vertical-align:text-bottom;} +input,textarea,select{font-family:inherit;font-size: 13px/1.23;font-weight:normal;} +input,textarea,select{*font-size:100%;} +legend{color:#000;} +/* body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;} */ +body {font:13px/1.231 "Lucida Grande",Verdana,Lucida,Helvetica,Arial,sans-serif;*font-size:small;*font:x-small;} +table {font-size:inherit;font:100%;} +pre,code,kbd,samp,tt{font-family:monospace;} + + +body{text-align:left;} +.inlinefooter{clear:both;} + +/* #doc,#doc2,#doc3,#doc4,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7{margin:auto;text-align:left;width:57.69em;*width:56.25em;min-width:750px;} */ +.page {margin:auto;text-align:left;width:57.69em;*width:56.25em;min-width:750px;} + +/* #doc3{margin:auto 10px;width:auto;} */ +.page {margin:auto 10px;width:auto;} + +#pagebody, .sidebar{position:relative;} +#pagebody, .sidebar{_position:static;} +#pagebody {position:static;} +.sidebar {float:right;width:16.5em;*width:16em;} +#pagebody {margin-right:19em;*margin-right:18.5em;} +/* #content {float:none;width:auto;} */ +#pagebody:after, .sidebar:after, .page:after{content:".";display:block;height:0;clear:both;visibility:hidden;} +.page f{zoom:1;} + +/* ------------------------------------------------------------------------------------------------ + * Taken from base.css, part of YUI's CSS Foundation + * Copyright (c) 2008, Yahoo! Inc. All rights reserved. + * Code licensed under the BSD License: + * http://developer.yahoo.net/yui/license.txt + * version: 2.5.1 +*/ +h1 { + /*18px via YUI Fonts CSS foundation*/ + font-size:138.5%; +} +h2 { + /*16px via YUI Fonts CSS foundation*/ + font-size:123.1%; +} +h3 { + /*14px via YUI Fonts CSS foundation*/ + font-size:108%; +} +h1,h2,h3 { + /* top & bottom margin based on font size */ + margin:1em 0; +} +h1,h2,h3,h4,h5,h6,strong { + /*bringing boldness back to headers and the strong element*/ + font-weight:bold; +} +abbr,acronym { + /*indicating to users that more info is available */ + border-bottom:1px dotted #000; + cursor:help; +} +em { + /*bringing italics back to the em element*/ + font-style:italic; +} +blockquote,ul,ol,dl { + /*giving blockquotes and lists room to breath*/ + margin:1em; +} +ol,ul,dl { + /*bringing lists on to the page with breathing room */ + margin-left:2em; +} +ol li { + /*giving OL's LIs generated numbers*/ + list-style: decimal outside; +} +ul li { + /*giving UL's LIs generated disc markers*/ + list-style: disc outside; +} +dl dd { + /*giving UL's LIs generated numbers*/ + margin-left:1em; +} +th,td { + /*borders and padding to make the table readable*/ + border:1px solid #000; + padding:.5em; +} +th { + /*distinguishing table headers from data cells*/ + font-weight:bold; + text-align:center; +} +caption { + /*coordinated margin to match cell's padding*/ + margin-bottom:.5em; + /*centered so it doesn't blend in to other content*/ + text-align:center; +} +p,fieldset,table,pre { + /*so things don't run into each other*/ + margin-bottom:1em; +} + +#searchbox { + width:21.5em;*width:21em; +} + + + +/* ------------------------------------------------------------------------------------------------ + * All CSS below is + * Copyright (C) 2010 Bernd Zeimetz + * Licensed under same license as ikiwiki: GPL v2 or later */ + +.page, .pageheader, .sidebar, #content, #comments, .inlinepage, .recentchanges, .pageheader .actions ul, #pagebody { + border: none; +} + +html, body { + color:#000; + /* background-image: url('body_background.png'); + background-repeat: repeat; */ + background-color: #8da1b8; +} + +body { + padding-left: 5%; + padding-right: 5%; + padding-top: 1em; + padding-bottom: 1em; +} + +.page { + background: #fff; + border: outset #ccc; + padding-left: 1em; + padding-right: 1em; + padding-top: 1em; +} + +.pageheader { + background-image: url('header_background.png'); + background-repeat: repeat-x; + height: 100px; + padding-left: 1em; + padding-right: 1em; + padding-bottom: 1em; + padding-top: 1em; +} + +.pageheader .header { + text-align: top; + clear: both; +} + +.pageheader .header form { + padding: 0em 0em 0em 0em; + float: right; + margin-top: 0.5em; +} + +.pageheader .header .title, .pageheader .header .parentlinks, + .inlinepage .inlineheader, + h1, h2, h3, h4, h5, h6 { + margin-top: 1em; + font-weight: bold; +} + +.pageheader .header .title, .pageheader .header .parentlinks, .pageheader .actions ul li, .pageheader .header span { + padding: 0.25em 0.25em 0.25em 0.25em; + background-image: url('background_darkness.png'); + background-repeat: repeat; + color: white; +} + +.pageheader .header span a, .pageheader .actions ul li a, .pageheader .header .parentlinks a { + color: white; + text-decoration: none; +} + +.pageheader .actions { + text-align: right; + vertical-align: bottom; + clear: both; +} + +#pagebody { + padding-right: 1em; + padding-bottom: 2em; + border-right: ridge #eee; + clear: none; +} + +#content a, #comments a, .sidebar a { + color: #315485; + text-decoration: none; + font-weight: bold; +} + +.sidebar h2 { + border-bottom: ridge #eee; + padding-right: 0; +} + +.sidebar .menu { + margin-left: 1em; +} + + +.inlinepage, .recentchanges, div.recentchanges { + clear: none !important; + margin-bottom: 2em; +} + +.inlinefooter { + border-top: 1px dotted #315485; +} + +.inlinefooter .pagedate, .inlinefooter .tags { + display: inline; + clear: none; + margin-right: 2em; +} + +.calendar .month-calendar th, .calendar .month-calendar td { + padding: 0.22em; +} + +@media print { + .sidebar, .page .pageheader .header .parentlinks { + content:"."; + display:block; + height:0; + visibility:hidden; + } + .page { + padding: 1em 1em 1em 1em; + } + .pageheader .header span a, .pageheader .actions ul li a, .pageheader .header .parentlinks a { + color #315485; + } + #content, #comments, #pagebody { + margin-right: 0; + *margin-right: 0; + border-right: none; + } + +} + diff --git a/underlays/themes/actiontabs/style.css b/underlays/themes/actiontabs/style.css deleted file mode 100644 index f48448e2e..000000000 --- a/underlays/themes/actiontabs/style.css +++ /dev/null @@ -1,123 +0,0 @@ -/* actiontabs theme for ikiwiki - * - * by svend - */ - -a { - text-decoration: none; - color: #005a9c; -} - -a:hover { - text-decoration: underline; -} - - -hr { - border-style: none; - background-color: #999; - height: 1px; -} - -code, pre { - background: #eee; -} - -pre { - padding: .5em; -} - -body { - margin: 0; - padding: 0; - font-family: sans-serif; - color: black; - background: white; -} - -.pageheader { - margin: 0; - padding: 1em 2em 0 2em; - background: #eee; - border-color: #999; - border-style: none none solid none; - border-width: 1px; -} - -.header { - font-size: 100%; - font-weight: normal; -} - -.title { - display: block; - margin-top: .2em; - font: 140% sans-serif; - text-transform: capitalize; -} - -.actions { - text-align: right; - padding: 0; -} - -#content, #comments, #footer { - margin: 1em 2em; -} - -#pageinfo { - border-color: #999; -} - -.inlinepage { - margin: .4em 0; - padding: .4em 0; - border-style: none; - border-top: 1px solid #aaa; -} - -.inlineheader { - font-size: 120%; - font-weight: normal; -} - -h1 { font: 120% sans-serif } -h2 { font: bold 100% sans-serif } -h3 { font: italic 100% sans-serif } -h4, h5, h6 { font: small-caps 100% sans-serif } - -/* Smaller headings for inline pages */ -.inlinepage h1 { font-size: 110% } -.inlinepage h2 { font-size: 100% } -.inlinepage h3 { font-size: 100% } - -.pageheader .actions ul { - border-style: none -} - -.actions ul { - font-size: 75%; - padding: 0; - border-style: none; -} - -.actions ul li a { - text-decoration: none; -} - -.actions ul li { - margin: 0; - padding: .1em .5em 0 .5em; - background: white; - border-color: #999; - border-style: solid solid none solid; - border-width: 1px; -} - -div.recentchanges { - border-style: none; -} - -.pagecloud { - width: auto; -} diff --git a/underlays/themes/bzed/background_darkness.png b/underlays/themes/bzed/background_darkness.png deleted file mode 100644 index 0a1cb4e9e..000000000 Binary files a/underlays/themes/bzed/background_darkness.png and /dev/null differ diff --git a/underlays/themes/bzed/style.css b/underlays/themes/bzed/style.css deleted file mode 100644 index 540cac415..000000000 --- a/underlays/themes/bzed/style.css +++ /dev/null @@ -1,280 +0,0 @@ -/* bzed theme for ikiwiki - * - * Copyright (C) 2010 Bernd Zeimetz - * Licensed under same license as ikiwiki: GPL v2 or later - * - * Parts of this file are based on the awesome YUI, - * these parts will stay under the BSD license, - * but you're free to apply the GPLv2 to them, of course. - */ - - - -/* ------------------------------------------------------------------------------------------------- -Based on reset-fonts-grids.css from yui. -Copyright (c) 2008, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 2.5.1 -*/ -body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,legend,p,blockquote,th,td{margin:0;padding:0;} -table{border-collapse:collapse;border-spacing:0;} -img{border:0;} -address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;} -li{list-style:none;} -caption,th{text-align:left;} -h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;} -q:before,q:after{content:'';} -abbr,acronym {border:0;font-variant:normal;} -sup {vertical-align:text-top;} -sub {vertical-align:text-bottom;} -input,textarea,select{font-family:inherit;font-size: 13px/1.23;font-weight:normal;} -input,textarea,select{*font-size:100%;} -legend{color:#000;} -/* body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;} */ -body {font:13px/1.231 "Lucida Grande",Verdana,Lucida,Helvetica,Arial,sans-serif;*font-size:small;*font:x-small;} -table {font-size:inherit;font:100%;} -pre,code,kbd,samp,tt{font-family:monospace;} - - -body{text-align:left;} -.inlinefooter{clear:both;} - -/* #doc,#doc2,#doc3,#doc4,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7{margin:auto;text-align:left;width:57.69em;*width:56.25em;min-width:750px;} */ -.page {margin:auto;text-align:left;width:57.69em;*width:56.25em;min-width:750px;} - -/* #doc3{margin:auto 10px;width:auto;} */ -.page {margin:auto 10px;width:auto;} - -#pagebody, .sidebar{position:relative;} -#pagebody, .sidebar{_position:static;} -#pagebody {position:static;} -.sidebar {float:right;width:16.5em;*width:16em;} -#pagebody {margin-right:19em;*margin-right:18.5em;} -/* #content {float:none;width:auto;} */ -#pagebody:after, .sidebar:after, .page:after{content:".";display:block;height:0;clear:both;visibility:hidden;} -.page f{zoom:1;} - -/* ------------------------------------------------------------------------------------------------ - * Taken from base.css, part of YUI's CSS Foundation - * Copyright (c) 2008, Yahoo! Inc. All rights reserved. - * Code licensed under the BSD License: - * http://developer.yahoo.net/yui/license.txt - * version: 2.5.1 -*/ -h1 { - /*18px via YUI Fonts CSS foundation*/ - font-size:138.5%; -} -h2 { - /*16px via YUI Fonts CSS foundation*/ - font-size:123.1%; -} -h3 { - /*14px via YUI Fonts CSS foundation*/ - font-size:108%; -} -h1,h2,h3 { - /* top & bottom margin based on font size */ - margin:1em 0; -} -h1,h2,h3,h4,h5,h6,strong { - /*bringing boldness back to headers and the strong element*/ - font-weight:bold; -} -abbr,acronym { - /*indicating to users that more info is available */ - border-bottom:1px dotted #000; - cursor:help; -} -em { - /*bringing italics back to the em element*/ - font-style:italic; -} -blockquote,ul,ol,dl { - /*giving blockquotes and lists room to breath*/ - margin:1em; -} -ol,ul,dl { - /*bringing lists on to the page with breathing room */ - margin-left:2em; -} -ol li { - /*giving OL's LIs generated numbers*/ - list-style: decimal outside; -} -ul li { - /*giving UL's LIs generated disc markers*/ - list-style: disc outside; -} -dl dd { - /*giving UL's LIs generated numbers*/ - margin-left:1em; -} -th,td { - /*borders and padding to make the table readable*/ - border:1px solid #000; - padding:.5em; -} -th { - /*distinguishing table headers from data cells*/ - font-weight:bold; - text-align:center; -} -caption { - /*coordinated margin to match cell's padding*/ - margin-bottom:.5em; - /*centered so it doesn't blend in to other content*/ - text-align:center; -} -p,fieldset,table,pre { - /*so things don't run into each other*/ - margin-bottom:1em; -} - -#searchbox { - width:21.5em;*width:21em; -} - - - -/* ------------------------------------------------------------------------------------------------ - * All CSS below is - * Copyright (C) 2010 Bernd Zeimetz - * Licensed under same license as ikiwiki: GPL v2 or later */ - -.page, .pageheader, .sidebar, #content, #comments, .inlinepage, .recentchanges, .pageheader .actions ul, #pagebody { - border: none; -} - -html, body { - color:#000; - /* background-image: url('body_background.png'); - background-repeat: repeat; */ - background-color: #8da1b8; -} - -body { - padding-left: 5%; - padding-right: 5%; - padding-top: 1em; - padding-bottom: 1em; -} - -.page { - background: #fff; - border: outset #ccc; - padding-left: 1em; - padding-right: 1em; - padding-top: 1em; -} - -.pageheader { - background-image: url('header_background.png'); - background-repeat: repeat-x; - height: 100px; - padding-left: 1em; - padding-right: 1em; - padding-bottom: 1em; - padding-top: 1em; -} - -.pageheader .header { - text-align: top; - clear: both; -} - -.pageheader .header form { - padding: 0em 0em 0em 0em; - float: right; - margin-top: 0.5em; -} - -.pageheader .header .title, .pageheader .header .parentlinks, - .inlinepage .inlineheader, - h1, h2, h3, h4, h5, h6 { - margin-top: 1em; - font-weight: bold; -} - -.pageheader .header .title, .pageheader .header .parentlinks, .pageheader .actions ul li, .pageheader .header span { - padding: 0.25em 0.25em 0.25em 0.25em; - background-image: url('background_darkness.png'); - background-repeat: repeat; - color: white; -} - -.pageheader .header span a, .pageheader .actions ul li a, .pageheader .header .parentlinks a { - color: white; - text-decoration: none; -} - -.pageheader .actions { - text-align: right; - vertical-align: bottom; - clear: both; -} - -#pagebody { - padding-right: 1em; - padding-bottom: 2em; - border-right: ridge #eee; - clear: none; -} - -#content a, #comments a, .sidebar a { - color: #315485; - text-decoration: none; - font-weight: bold; -} - -.sidebar h2 { - border-bottom: ridge #eee; - padding-right: 0; -} - -.sidebar .menu { - margin-left: 1em; -} - - -.inlinepage, .recentchanges, div.recentchanges { - clear: none !important; - margin-bottom: 2em; -} - -.inlinefooter { - border-top: 1px dotted #315485; -} - -.inlinefooter .pagedate, .inlinefooter .tags { - display: inline; - clear: none; - margin-right: 2em; -} - -.calendar .month-calendar th, .calendar .month-calendar td { - padding: 0.22em; -} - -@media print { - .sidebar, .page .pageheader .header .parentlinks { - content:"."; - display:block; - height:0; - visibility:hidden; - } - .page { - padding: 1em 1em 1em 1em; - } - .pageheader .header span a, .pageheader .actions ul li a, .pageheader .header .parentlinks a { - color #315485; - } - #content, #comments, #pagebody { - margin-right: 0; - *margin-right: 0; - border-right: none; - } - -} -