svnpath => "trunk",
srcdir => undef,
destdir => undef,
+ pingurl => [],
templatedir => "/usr/share/ikiwiki/templates",
underlaydir => "/usr/share/ikiwiki/basewiki",
setup => undef,
local $/=undef;
open (IN, $file) || error("failed to read $file: $!");
- binmode(IN) if $binary;
+ if (! $binary) {
+ binmode(IN, ":utf8");
+ }
+ else {
+ binmode(IN);
+ }
my $ret=<IN>;
close IN;
return $ret;
}
open (OUT, ">$destdir/$file") || error("failed to write $destdir/$file: $!");
- binmode(OUT) if $binary;
+ if (! $binary) {
+ binmode(OUT, ":utf8");
+ }
+ else {
+ binmode(OUT);
+ }
print OUT $content;
close OUT;
} #}}}
my $page=shift;
my $glob=shift;
- # turn glob into safe regexp
- $glob=quotemeta($glob);
- $glob=~s/\\\*/.*/g;
- $glob=~s/\\\?/./g;
- $glob=~s!\\/!/!g;
-
- $page=~/^$glob$/i;
+ if ($glob =~ /^link\((.+)\)$/) {
+ my $rev = $links{$page} or return undef;
+ foreach my $p (@$rev) {
+ return 1 if lc $p eq $1;
+ }
+ return 0;
+ } elsif ($glob =~ /^backlink\((.+)\)$/) {
+ my $rev = $links{$1} or return undef;
+ foreach my $p (@$rev) {
+ return 1 if lc $p eq $page;
+ }
+ return 0;
+ } else {
+ # turn glob into safe regexp
+ $glob=quotemeta($glob);
+ $glob=~s/\\\*/.*/g;
+ $glob=~s/\\\?/./g;
+ $glob=~s!\\/!/!g;
+
+ return $page=~/^$glob$/i;
+ }
} #}}}
sub globlist_match ($$) { #{{{