]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/inline.pm
pagespec_match_list added and used in most appropriate places
[git.ikiwiki.info.git] / IkiWiki / Plugin / inline.pm
index 551c38a65157c64aef2fd6d8629eb9c18eeb2ee6..366357095ee24cee2ac61691538b92196f870e9d 100644 (file)
@@ -183,20 +183,9 @@ sub preprocess_inline (@) {
                $params{template} = $archive ? "archivepage" : "inlinepage";
        }
 
-       my @list;
-       my $lastmatch;
-       foreach my $page (keys %pagesources) {
-               next if $page eq $params{page};
-               $lastmatch=pagespec_match($page, $params{pages}, location => $params{page});
-               if ($lastmatch) {
-                       push @list, $page;
-               }
-       }
-
-       if (! @list && defined $lastmatch &&
-           $lastmatch->isa("IkiWiki::ErrorReason")) {
-               error(sprintf(gettext("cannot match pages: %s"), $lastmatch));
-       }
+       my @list=pagespec_match_list(
+               [ grep { $_ ne $params{page}} keys %pagesources ],
+               $params{pages}, location => $params{page});
 
        if (exists $params{sort} && $params{sort} eq 'title') {
                @list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list;