]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
New report.
[ikiwiki.git] / IkiWiki.pm
index e8c0c7abc70450e78d35b5cd04576c70eb3f9a70..6233d2eada36e376ccacbc3abe140598cf9004e4 100644 (file)
@@ -21,12 +21,12 @@ our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match
                  pagespec_match_list bestlink htmllink readfile writefile
                 pagetype srcfile pagename displaytime will_render gettext urlto
                 targetpage add_underlay pagetitle titlepage linkpage
-                newpagefile inject
+                newpagefile inject add_link
                  %config %links %pagestate %wikistate %renderedfiles
                  %pagesources %destsources);
 our $VERSION = 3.00; # plugin interface version, next is ikiwiki version
 our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
-our $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
+our $installdir='/usr'; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
 
 # Optimisation.
 use Memoize;
@@ -157,6 +157,13 @@ sub getsetup () {
                safe => 0, # path
                rebuild => 0,
        },
+       underlaydirbase => {
+               type => "internal",
+               default => "$installdir/share/ikiwiki",
+               description => "parent directory containing additional underlays",
+               safe => 0,
+               rebuild => 0,
+       },
        wrappers => {
                type => "internal",
                default => [],
@@ -715,7 +722,7 @@ sub add_underlay ($) {
        my $dir=shift;
 
        if ($dir !~ /^\//) {
-               $dir="$config{underlaydir}/../$dir";
+               $dir="$config{underlaydirbase}/$dir";
        }
 
        if (! grep { $_ eq $dir } @{$config{underlaydirs}}) {
@@ -1757,6 +1764,14 @@ sub inject {
        use warnings;
 }
 
+sub add_link ($$) {
+       my $page=shift;
+       my $link=shift;
+
+       push @{$links{$page}}, $link
+               unless grep { $_ eq $link } @{$links{$page}};
+}
+
 sub pagespec_merge ($$) {
        my $a=shift;
        my $b=shift;
@@ -1837,8 +1852,6 @@ sub pagespec_match_list ($$;@) {
        my $spec=shift;
        my @params=@_;
 
-       return @$pages if $spec eq '*'; # optimisation
-
        my $sub=pagespec_translate($spec);
        error "syntax error in pagespec \"$spec\""
                if $@ || ! defined $sub;