aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/inline.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-04-23 14:07:28 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-04-23 14:07:28 -0400
commit748aa7af777caaa32ac5ab56e707509b3739b49e (patch)
treee5ab8791c45420d114efee9df68cee2ef8181478 /IkiWiki/Plugin/inline.pm
parent2c74f09bb870c717669f273ba7d4aa1637dcccf1 (diff)
downloadikiwiki-748aa7af777caaa32ac5ab56e707509b3739b49e.tar
ikiwiki-748aa7af777caaa32ac5ab56e707509b3739b49e.tar.gz
pagespec error/failure distinction and error display by inline
* Add IkiWiki::ErrorReason objects, and modify pagespecs to return them in cases where they fail to match due to a configuration or syntax error. * inline: Display a handy error message if the inline cannot display any pages due to such an error. This is perhaps somewhat incomplete, as other users of pagespecs do not display the error, and will eventually need similar modifications to inline. I should probably factor out a pagespec_match_all function and make it throw ErrorReasons.
Diffstat (limited to 'IkiWiki/Plugin/inline.pm')
-rw-r--r--IkiWiki/Plugin/inline.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 9d7d4b0fd..551c38a65 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -184,13 +184,20 @@ sub preprocess_inline (@) {
}
my @list;
+ my $lastmatch;
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;
}
}
+ 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;
}