- my @links;
- while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) {
- push @links, titlepage($2);
- }
- if ($config{discussion}) {
- # Discussion links are a special case since they're not in the
- # text of the page, but on its template.
- return @links, "$page/discussion";
+ my $type=pagetype($file);
+ if (defined $type) {
+ my $srcfile=srcfile($file);
+ my $content=readfile($srcfile);
+ my $page=pagename($file);
+ will_render($page, htmlpage($page), 1);
+
+ # Always needs to be done, since filters might add links
+ # to the content.
+ $content=filter($page, $content);
+
+ my @links;
+ while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) {
+ push @links, linkpage($2);
+ }
+ if ($config{discussion}) {
+ # Discussion links are a special case since they're
+ # not in the text of the page, but on its template.
+ push @links, $page."/".gettext("discussion");
+ }
+ $links{$page}=\@links;
+
+ # Preprocess in scan-only mode.
+ preprocess($page, $page, $content, 1);