aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-08-28 01:59:01 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-08-28 01:59:01 +0000
commit9c5f4761d8bf785ca98d5fda66fbbe9dbe11897c (patch)
tree6e2c8fab91dd051a7acc2cf0ab7c71fc58f6c278 /IkiWiki.pm
parent21c4bd8444480d6038d217fa2892d13ecce500ff (diff)
downloadikiwiki-9c5f4761d8bf785ca98d5fda66fbbe9dbe11897c.tar
ikiwiki-9c5f4761d8bf785ca98d5fda66fbbe9dbe11897c.tar.gz
* Support for looking in multiple directories for underlay files.
* Plugins can add new directories to the search path with the add_underlay function. * Split out smiley underlay files into a separate underlay, so if the plugin isn't used, the wiki isn't bloated with all those files.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm21
1 files changed, 19 insertions, 2 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 18a518f3f..0485da75c 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -17,6 +17,7 @@ use Exporter q{import};
our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match
bestlink htmllink readfile writefile pagetype srcfile pagename
displaytime will_render gettext urlto targetpage
+ add_underlay
%config %links %renderedfiles %pagesources %destsources);
our $VERSION = 2.00; # plugin interface version, next is ikiwiki version
our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
@@ -83,6 +84,7 @@ sub defaultconfig () { #{{{
pingurl => [],
templatedir => "$installdir/share/ikiwiki/templates",
underlaydir => "$installdir/share/ikiwiki/basewiki",
+ underlaydirs => [],
setup => undef,
adminuser => undef,
adminemail => undef,
@@ -285,11 +287,26 @@ sub srcfile ($) { #{{{
my $file=shift;
return "$config{srcdir}/$file" if -e "$config{srcdir}/$file";
- return "$config{underlaydir}/$file" if -e "$config{underlaydir}/$file";
- error("internal error: $file cannot be found in $config{srcdir} or $config{underlaydir}");
+ foreach my $dir (@{$config{underlaydirs}}, $config{underlaydir}) {
+ return "$dir/$file" if -e "$dir/$file";
+ }
+ error("internal error: $file cannot be found in $config{srcdir} or underlay");
return;
} #}}}
+sub add_underlay ($) { #{{{
+ my $dir=shift;
+
+ if ($dir=~/^\//) {
+ unshift @{$config{underlaydirs}}, $dir;
+ }
+ else {
+ unshift @{$config{underlaydirs}}, "$config{underlaydir}/../$dir";
+ }
+
+ return 1;
+} #}}}
+
sub readfile ($;$$) { #{{{
my $file=shift;
my $binary=shift;