]> sipb.mit.edu Git - ikiwiki.git/commitdiff
pagespec_match_list allow additional pagespec limit parameters again
authorJoey Hess <joey@gnu.kitenet.net>
Fri, 9 Oct 2009 17:02:10 +0000 (13:02 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Fri, 9 Oct 2009 17:02:10 +0000 (13:02 -0400)
IkiWiki.pm
doc/plugins/write.mdwn

index 475e278c3b3ef5ad7a434f0cf84bc3117b340436..f959d868b1e659926577874b1404545184037182 100644 (file)
@@ -2019,21 +2019,25 @@ sub pagespec_match_list ($$;@) {
 
        @candidates=reverse(@candidates) if $params{reverse};
        
+       $depends{$page}{$pagespec} |= ($params{deptype} || $DEPEND_CONTENT);
+       
+       # clear params, remainder is passed to pagespec
+       my $num=$params{num};
+       delete @params{qw{num deptype reverse sort limit}};
+       
        my @matches;
        my $firstfail;
        my $count=0;
        foreach my $p (@candidates) {
-               my $r=$sub->($p, location => $page);
+               my $r=$sub->($p, %params, location => $page);
                if ($r) {
                        push @matches, [$p, $r];
-                       last if defined $params{num} && ++$count == $params{num};
+                       last if defined $num && ++$count == $num;
                }
                elsif (! defined $firstfail) {
                        $firstfail=$r;
                }
        }
-       
-       $depends{$page}{$pagespec} |= ($params{deptype} || $DEPEND_CONTENT);
 
        my @ret;
        if (@matches) {
index f6ea76c3607fca1104ae9d999799d8e693c598ca..9661bf4def17e3fbbdb0db80611e45c1bac5f114 100644 (file)
@@ -636,6 +636,9 @@ is significantly more efficient than calling `add_depends` and
 `pagespec_match` in a loop. You should use this anytime a plugin
 needs to match a set of pages and do something based on that list.
 
+Unlike pagespec_match, this may throw an error if there is an error in
+the pagespec.
+
 Additional named parameters can be specified:
 
 * `deptype` optionally specifies the type of dependency to add. Use the
@@ -650,8 +653,8 @@ Additional named parameters can be specified:
 * `list` makes it only match amoung the specified list of pages.
   Default is to match amoung all pages in the wiki.
 
-Unlike pagespec_match, this may throw an error if there is an error in
-the pagespec.
+Any other named parameters are passed on to `pagespec_match`, to further
+limit the match.
 
 #### `add_depends($$;$)`