diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2009-01-26 13:05:38 -0500 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-01-26 13:05:38 -0500 |
commit | 12eb056b33e1f01a63c4fcee408c9ac0d96c6b5e (patch) | |
tree | 988f9eb2099e98141844c205f553f13203cbc0ff /doc/plugins/contrib/underlay.mdwn | |
parent | f8c306a21b2d7b137fbc9245079d2db8b75366e1 (diff) | |
parent | 9b436a0347e28c52a0d669be64e259b3d0323815 (diff) |
Merge branch 'master' into po
Diffstat (limited to 'doc/plugins/contrib/underlay.mdwn')
-rw-r--r-- | doc/plugins/contrib/underlay.mdwn | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/doc/plugins/contrib/underlay.mdwn b/doc/plugins/contrib/underlay.mdwn new file mode 100644 index 000000000..72893c992 --- /dev/null +++ b/doc/plugins/contrib/underlay.mdwn @@ -0,0 +1,58 @@ +[[!template id=plugin name=underlay author="[[Simon_McVittie|smcv]]"]] +[[!tag type/useful]] + +This plugin adds an `add_underlays` option to the `.setup` file. +Its value is a list of underlay directories whose content is added to the wiki. + +Multiple underlays are normally set up automatically by other plugins (for +instance, the images used by the [[plugins/smiley]] plugin), but they can also be +used as a way to pull in external files that you don't want in revision control, +like photos or software releases. + +Directories in `add_underlays` should usually be absolute. If relative, they're +interpreted as relative to the parent directory of the basewiki underlay, which +is probably not particularly useful in this context. + +Please feel free to add this plugin to ikiwiki if it seems like a good +thing to have. See the 'underlay' branch in my git repository. + + #!/usr/bin/perl + package IkiWiki::Plugin::underlay; + # Copyright © 2008 Simon McVittie <http://smcv.pseudorandom.co.uk/> + # Licensed under the GNU GPL, version 2, or any later version published by the + # Free Software Foundation + + use warnings; + use strict; + use IkiWiki 2.00; + + sub import { + hook(type => "getsetup", id => "underlay", call => \&getsetup); + hook(type => "checkconfig", id => "underlay", call => \&checkconfig); + } + + sub getsetup () { + return + plugin => { + safe => 0, + rebuild => undef, + }, + add_underlays => { + type => "string", + default => [], + description => "extra underlay directories to add", + advanced => 1, + safe => 0, + rebuild => 1, + }, + } + + sub checkconfig () { + return unless exists $config{add_underlays}; + + foreach my $dir (@{$config{add_underlays}}) { + add_underlay($dir); + } + } + + 1; |