- # 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("rendering %s, which depends on %s"), $f, $page));
+ foreach my $d (keys %{$depends{$p}}) {
+ # only consider internal files
+ # if the page explicitly depends on such files
+ my @pages = map {
+ pagename($_)
+ } grep {
+ $_ ne $f
+ } (@changed, $d =~ /internal\(/ ? @internal : ());
+ @pages = pagespec_match_list(\@pages, $d, location => $p);
+ if (@pages) {
+ debug(sprintf(gettext("building %s, which depends on %s"), $f, $pages[0]));