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;
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 => [],
my $dir=shift;
if ($dir !~ /^\//) {
- $dir="$config{underlaydir}/../$dir";
+ $dir="$config{underlaydirbase}/$dir";
}
if (! grep { $_ eq $dir } @{$config{underlaydirs}}) {
|
"[^"]+" # single-quoted value
|
- [^\s\]]+ # unquoted value
+ [^"\s\]]+ # unquoted value
)
\s* # whitespace or end
# of directive
|
"[^"]+" # single-quoted value
|
- [^\s\]]+ # unquoted value
+ [^"\s\]]+ # unquoted value
)
\s* # whitespace or end
# of directive
$hooks{rcs}{rcs_receive}{call}->();
}
-sub safequote ($) {
- my $s=shift;
- $s=~s/[{}]//g;
- return "q{$s}";
-}
-
sub add_depends ($$) {
my $page=shift;
my $pagespec=shift;
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;
# Convert spec to perl code.
my $code="";
+ my @data;
while ($spec=~m{
\s* # ignore whitespace
( # 1: match a single word
}
elsif ($word =~ /^(\w+)\((.*)\)$/) {
if (exists $IkiWiki::PageSpec::{"match_$1"}) {
- $code.="IkiWiki::PageSpec::match_$1(\$page, ".safequote($2).", \@_)";
+ push @data, $2;
+ $code.="IkiWiki::PageSpec::match_$1(\$page, \$data[$#data], \@_)";
}
else {
- $code.="IkiWiki::ErrorReason->new(".safequote(qq{unknown function in pagespec "$word"}).")";
+ push @data, qq{unknown function in pagespec "$word"};
+ $code.="IkiWiki::ErrorReason->new(\$data[$#data])";
}
}
else {
- $code.=" IkiWiki::PageSpec::match_glob(\$page, ".safequote($word).", \@_)";
+ push @data, $word;
+ $code.=" IkiWiki::PageSpec::match_glob(\$page, \$data[$#data], \@_)";
}
}