underlay: Also allow configuring additional directories to search for template files in.
parent
93ab004cc2
commit
2a99ebf276
10
IkiWiki.pm
10
IkiWiki.pm
|
@ -150,6 +150,13 @@ sub getsetup () {
|
||||||
safe => 0, # path
|
safe => 0, # path
|
||||||
rebuild => 1,
|
rebuild => 1,
|
||||||
},
|
},
|
||||||
|
templatedirs => {
|
||||||
|
type => "internal",
|
||||||
|
default => [],
|
||||||
|
description => "additional directories containing template files",
|
||||||
|
safe => 0,
|
||||||
|
rebuild => 0,
|
||||||
|
},
|
||||||
underlaydir => {
|
underlaydir => {
|
||||||
type => "string",
|
type => "string",
|
||||||
default => "$installdir/share/ikiwiki/basewiki",
|
default => "$installdir/share/ikiwiki/basewiki",
|
||||||
|
@ -1610,7 +1617,8 @@ sub saveindex () {
|
||||||
sub template_file ($) {
|
sub template_file ($) {
|
||||||
my $template=shift;
|
my $template=shift;
|
||||||
|
|
||||||
foreach my $dir ($config{templatedir}, "$installdir/share/ikiwiki/templates") {
|
foreach my $dir ($config{templatedir}, @{$config{templatedirs}},
|
||||||
|
"$installdir/share/ikiwiki/templates") {
|
||||||
return "$dir/$template" if -e "$dir/$template";
|
return "$dir/$template" if -e "$dir/$template";
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -27,14 +27,21 @@ sub getsetup () {
|
||||||
safe => 0,
|
safe => 0,
|
||||||
rebuild => 1,
|
rebuild => 1,
|
||||||
},
|
},
|
||||||
|
add_templates => {
|
||||||
|
type => "string",
|
||||||
|
default => [],
|
||||||
|
description => "extra template directories to add",
|
||||||
|
advanced => 1,
|
||||||
|
safe => 0,
|
||||||
|
rebuild => 1,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
sub checkconfig () {
|
sub checkconfig () {
|
||||||
return unless exists $config{add_underlays};
|
|
||||||
|
|
||||||
foreach my $dir (@{$config{add_underlays}}) {
|
foreach my $dir (@{$config{add_underlays}}) {
|
||||||
add_underlay($dir);
|
add_underlay($dir);
|
||||||
}
|
}
|
||||||
|
push @{$config{templatedirs}}, @{$config{add_templates}};
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -4,6 +4,8 @@ ikiwiki (3.14159265) UNRELEASED; urgency=low
|
||||||
including Philippe Batailler, Alexandre Dupas, and Steve Petruzzello.
|
including Philippe Batailler, Alexandre Dupas, and Steve Petruzzello.
|
||||||
* Expand banned_users; it can now include PageSpecs, which
|
* Expand banned_users; it can now include PageSpecs, which
|
||||||
allows banning by IP address.
|
allows banning by IP address.
|
||||||
|
* underlay: Also allow configuring additional directories to search
|
||||||
|
for template files in.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Wed, 02 Sep 2009 15:01:27 -0400
|
-- Joey Hess <joeyh@debian.org> Wed, 02 Sep 2009 15:01:27 -0400
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[[!template id=plugin name=underlay author="[[Simon_McVittie|smcv]]"]]
|
[[!template id=plugin name=underlay author="[[Simon_McVittie|smcv]]"]]
|
||||||
[[!tag type/useful]]
|
[[!tag type/useful]]
|
||||||
|
|
||||||
This plugin adds an `add_underlays` option to the `.setup` file.
|
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.
|
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
|
Multiple underlays are normally set up automatically by other plugins (for
|
||||||
|
@ -12,3 +12,9 @@ like photos or software releases.
|
||||||
Directories in `add_underlays` should usually be absolute. If relative, they're
|
Directories in `add_underlays` should usually be absolute. If relative, they're
|
||||||
interpreted as relative to the parent directory of the basewiki underlay, which
|
interpreted as relative to the parent directory of the basewiki underlay, which
|
||||||
is probably not particularly useful in this context.
|
is probably not particularly useful in this context.
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
This plugin also adds an `add_templates` option to the setup file.
|
||||||
|
Its value is a list of template directories to look for template files in,
|
||||||
|
if they are not present in the `templatedir`.
|
||||||
|
|
Loading…
Reference in New Issue