]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/inline.pm
pagespec error/failure distinction and error display by inline
[ikiwiki.git] / IkiWiki / Plugin / inline.pm
index 9d7d4b0fd832d32aa7c00ece7ede97ca1847508f..551c38a65157c64aef2fd6d8629eb9c18eeb2ee6 100644 (file)
@@ -184,13 +184,20 @@ sub preprocess_inline (@) {
        }
 
        my @list;
        }
 
        my @list;
+       my $lastmatch;
        foreach my $page (keys %pagesources) {
                next if $page eq $params{page};
        foreach my $page (keys %pagesources) {
                next if $page eq $params{page};
-               if (pagespec_match($page, $params{pages}, location => $params{page})) {
+               $lastmatch=pagespec_match($page, $params{pages}, location => $params{page});
+               if ($lastmatch) {
                        push @list, $page;
                }
        }
 
                        push @list, $page;
                }
        }
 
+       if (! @list && defined $lastmatch &&
+           $lastmatch->isa("IkiWiki::ErrorReason")) {
+               error(sprintf(gettext("cannot match pages: %s"), $lastmatch));
+       }
+
        if (exists $params{sort} && $params{sort} eq 'title') {
                @list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list;
        }
        if (exists $params{sort} && $params{sort} eq 'title') {
                @list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list;
        }