+
+ if (exists $depends{$p} && ! defined $reason) {
+ D: foreach my $d (keys %{$depends{$p}}) {
+ my $sub=pagespec_translate($d);
+ next if $@ || ! defined $sub;
+
+ my @candidates;
+ if ($depends_simple{$p}{$d} & $IkiWiki::DEPEND_CONTENT) {
+ @candidates=@changed;
+ }
+ elsif ($depends{$p}{$d} & $IkiWiki::DEPEND_PRESENCE) {
+ @candidates=@exists_changed;
+ }
+ # only consider internal files
+ # if the page explicitly depends
+ # on such files
+ if ($d =~ /internal\(/) {
+ if ($depends_simple{$p}{$d} & $IkiWiki::DEPEND_CONTENT) {
+ push @candidates, @internal, @internal_change;
+ }
+ elsif ($depends{$p}{$d} & $IkiWiki::DEPEND_PRESENCE) {
+ push @candidates, @internal;
+ }
+ }
+
+ foreach my $file (@candidates) {
+ next if $file eq $f;
+ my $page=pagename($file);
+ if ($sub->($page, location => $p)) {
+ $reason = $page;
+ last D;
+ }
+ }
+ }
+ }
+
+ if (defined $reason) {
+ debug(sprintf(gettext("building %s, which depends on %s"), $f, $reason));
+ render($f);
+ $rendered{$f}=1;
+ $changes++;
+ last;
+ }