From b7cd40c1bb0e0c88155c0948f8475db3479153c8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 18 Jan 2009 16:42:12 +0000 Subject: Add underlay plugin --- IkiWiki/Plugin/underlay.pm | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 IkiWiki/Plugin/underlay.pm diff --git a/IkiWiki/Plugin/underlay.pm b/IkiWiki/Plugin/underlay.pm new file mode 100644 index 000000000..380d418fb --- /dev/null +++ b/IkiWiki/Plugin/underlay.pm @@ -0,0 +1,40 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::underlay; +# Copyright © 2008 Simon McVittie +# Licensed under the GNU GPL, version 2, or any later version published by the +# Free Software Foundation + +use warnings; +use strict; +use IkiWiki 3.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; -- cgit v1.2.3 From 2fd1857a527303f529274a229596dd6eb64b0a48 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 18 Jan 2009 16:43:07 +0000 Subject: Document underlay plugin as included --- doc/plugins/contrib/underlay.mdwn | 58 --------------------------------------- doc/plugins/underlay.mdwn | 14 ++++++++++ 2 files changed, 14 insertions(+), 58 deletions(-) delete mode 100644 doc/plugins/contrib/underlay.mdwn create mode 100644 doc/plugins/underlay.mdwn diff --git a/doc/plugins/contrib/underlay.mdwn b/doc/plugins/contrib/underlay.mdwn deleted file mode 100644 index 72893c992..000000000 --- a/doc/plugins/contrib/underlay.mdwn +++ /dev/null @@ -1,58 +0,0 @@ -[[!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 - # 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; diff --git a/doc/plugins/underlay.mdwn b/doc/plugins/underlay.mdwn new file mode 100644 index 000000000..09d096a6e --- /dev/null +++ b/doc/plugins/underlay.mdwn @@ -0,0 +1,14 @@ +[[!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. -- cgit v1.2.3