- foreach my $link (keys %linkchanged) {
- my $linkfile=$pagesources{$link};
- if (defined $linkfile) {
- next if $rendered{$linkfile};
- debug(sprintf(gettext("rendering %s, to update its backlinks"), $linkfile));
- render($linkfile);
- $rendered{$linkfile}=1;
+ # only consider internal files
+ # if the page explicitly depends
+ # on such files
+ my $internal_dep=$d =~ /internal\(/;
+
+ my @candidates;
+ if ($depends{$p}{$d} & $IkiWiki::DEPEND_PRESENCE) {
+ @candidates=@exists_changed;
+ push @candidates, @internal
+ if $internal_dep;
+ }
+ if (($depends{$p}{$d} & ($IkiWiki::DEPEND_CONTENT | $IkiWiki::DEPEND_LINKS))) {
+ @candidates=@changed;
+ push @candidates, @internal, @internal_change
+ if $internal_dep;
+ }
+
+ foreach my $file (@candidates) {
+ next if $file eq $f;
+ my $page=pagename($file);
+ if ($sub->($page, location => $p)) {
+ if ($depends{$p}{$d} & $IkiWiki::DEPEND_LINKS) {
+ next unless $linkchangers{lc($page)};
+ }
+ $reason = $page;
+ last D;
+ }
+ }