$links{$page}=$d->{links};
$oldlinks{$page}=[@{$d->{links}}];
}
- if (exists $d->{depends}) {
- $depends{$page}=$d->{depends};
+ if (exists $d->{dependslist}) {
+ $depends{$page}=$d->{dependslist};
+ }
+ elsif (exists $d->{depends}) {
+ $depends{$page}=[$d->{depends}];
}
if (exists $d->{state}) {
$pagestate{$page}=$d->{state};
};
if (exists $depends{$page}) {
- $index{page}{$src}{depends} = $depends{$page};
+ $index{page}{$src}{depends} = join(" or ", @{$depends{$page}});
+ $index{page}{$src}{dependslist} = $depends{$page};
}
if (exists $pagestate{$page}) {
sub add_depends ($$) {
my $page=shift;
my $pagespec=shift;
-
+
return unless pagespec_valid($pagespec);
if (! exists $depends{$page}) {
- $depends{$page}=$pagespec;
+ $depends{$page}=[$pagespec];
}
else {
- $depends{$page}=pagespec_merge($depends{$page}, $pagespec);
+ foreach my $p (@{$depends{$page}}) {
+ return 1 if $p eq $pagespec;
+ }
+ push @{$depends{$page}}, $pagespec;
}
return 1;
my @changed=(keys %rendered, @del);
# rebuild dependant pages
- foreach my $f (@$files) {
+ F: foreach my $f (@$files) {
next if $rendered{$f};
my $p=pagename($f);
if (exists $depends{$p}) {
- # only consider internal files
- # if the page explicitly depends on such files
- foreach my $file (@changed, $depends{$p}=~/internal\(/ ? @internal : ()) {
- next if $f eq $file;
- my $page=pagename($file);
- if (pagespec_match($page, $depends{$p}, location => $p)) {
- debug(sprintf(gettext("building %s, which depends on %s"), $f, $page));
- render($f);
- $rendered{$f}=1;
- last;
+ foreach my $d (@{$depends{$p}}) {
+ # only consider internal files
+ # if the page explicitly depends on such files
+ foreach my $file (@changed, $d=~/internal\(/ ? @internal : ()) {
+ next if $f eq $file;
+ my $page=pagename($file);
+ if (pagespec_match($page, $d, location => $p)) {
+ debug(sprintf(gettext("building %s, which depends on %s"), $f, $page));
+ render($f);
+ $rendered{$f}=1;
+ next F;
+ }
}
}
}
$pagemtime{$page}=$items{mtime}[0];
$oldlinks{$page}=[@{$items{link}}];
$links{$page}=[@{$items{link}}];
- $depends{$page}=$items{depends}[0] if exists $items{depends};
+ $depends{$page}=[$items{depends}[0]] if exists $items{depends};
$destsources{$_}=$page foreach @{$items{dest}};
$renderedfiles{$page}=[@{$items{dest}}];
$pagecase{lc $page}=$page;
$links{"Foo"}=["bar.png"];
$links{"bar"}=["Foo", "new-page"];
$links{"bar.png"}=[];
-$depends{"Foo"}="";
-$depends{"bar"}="foo*";
-$depends{"bar.png"}="";
+$depends{"Foo"}=[];
+$depends{"bar"}=["foo*"];
+$depends{"bar.png"}=[];
$pagestate{"bar"}{meta}{title}="a page about bar";
$pagestate{"bar"}{meta}{moo}="mooooo";
# only loaded plugins save state, so this should not be saved out
"bar.png" => [],
}, "%links loaded correctly");
is_deeply(\%depends, {
- Foo => "",
- bar => "foo*",
- "bar.png" => "",
+ Foo => [],
+ bar => ["foo*"],
+ "bar.png" => [],
}, "%depends loaded correctly");
is_deeply(\%pagestate, {
bar => {