diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2009-04-23 15:45:30 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-04-23 15:45:30 -0400 |
commit | aa306957bac11477b914ac19b93890184ffe4062 (patch) | |
tree | c9b05bf73cb4d19e55297ad3b335bb1fc3ce67e5 /IkiWiki/Plugin/inline.pm | |
parent | 527d178c12141d2467dfa86492e249d021b88997 (diff) | |
download | ikiwiki-aa306957bac11477b914ac19b93890184ffe4062.tar ikiwiki-aa306957bac11477b914ac19b93890184ffe4062.tar.gz |
pagespec_match_list added and used in most appropriate places
* pagespec_match_list: New API function, matches pages in a list
and throws an error if the pagespec is bad.
* inline, brokenlinks, calendar, linkmap, map, orphans, pagecount,
pagestate, postsparkline: Display a handy error message if the pagespec
is erronious.
Diffstat (limited to 'IkiWiki/Plugin/inline.pm')
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 551c38a65..366357095 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -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; |