response
[ikiwiki] / doc / todo / tracking_bugs_with_dependencies.mdwn
1 I like the idea of [[tips/integrated_issue_tracking_with_ikiwiki]], and I do so on several wikis.  However, as far as I can tell, ikiwiki has no functionality which can represent dependencies between bugs and allow pagespecs to select based on dependencies.  For instance, I can't write a pagespec which selects all bugs with no dependencies on bugs not marked as done.  --[[JoshTriplett]]
2
3 > I started having a think about this.  I'm going to start with the idea that expanding
4 > the pagespec syntax is the way to attack this.  It seems that any pagespec that is going
5 > to represent "all bugs with no dependencies on bugs not marked as done" is going to
6 > need some way to represent "bugs not marked as done" as a collection of pages, and
7 > then represent "bugs which do not link to pages in the previous collection".
8 >
9 > One way to do this would be to introduce variables into the pagespec, along with
10 > universal and/or existential [[!wikipedia Quantification]].  That looks quite complex.
11 >
12 >> I thought about this briefly, and got about that far.. glad you got
13 >> further. :-) --[[Joey]]
14
15 > Another option would be go with a more functional syntax.  The concept here would
16 > be to allow a pagespec to appear in a 'pagespec function' anywhere a page can.  e.g.
17 > I could pass a pagespec to `link()` and that would return true if there is a link to any
18 > page matching the pagespec.  This makes the variables and existential quantification
19 > implicit.  It would allow the example requested above:
20 >
21 >> `bugs/* and !*/Discussion and !link(bugs/* and !*/Discussion and !link(done))`
22 >
23 > Unfortunately, this is also going to make the pagespec parsing more complex because
24 > we now need to parse nested sets of parentheses to know when the nested pagespec
25 > ends, and that isn't a regular language (we can't use regular expression matching for
26 > easy parsing).
27 >
28 >> Also, it may cause ambiguities with page names that contain parens
29 >> (though some such ambigutities already exist with the pagespec syntax).
30 >
31 > One simplification of that would be to introduce some pagespec [[shortcuts]].  We could
32 > then allow pagespec functions to take either pages, or named pagespec shortcuts.  The
33 > pagespec shortcuts would just be listed on a special page, like current [[shortcuts]].
34 > (It would probably be a good idea to require that shortcuts on that page can only refer
35 > to named pagespecs higher up that page than themselves.  That would stop some
36 > looping issues...)  These shortcuts would be used as follows: when trying to match
37 > a page (without globs) you look to see if the page exists.  If it does then you have a
38 > match.  If it doesn't, then you look to see if a similarly named pagespec shortcut
39 > exists.  If it does, then you check that pagespec recursively to see if you have a match.
40 > The ordering requirement on named pagespecs stops infinite recursion.
41 >
42 > Does that seem like a reasonable first approach?
43 >
44 > -- [[Will]]
45
46 >> Having a separate page for the shortcuts feels unwieldly.. perhaps
47 >> instead the shortcut could be defined earlier in the scope of the same
48 >> pagespec that uses it?
49 >> 
50 >> Example: `define(~bugs, bugs/* and !*/Discussion) and define(~openbugs, ~bugs and !link(done)) and ~openbugs and !link(~openbugs)`
51
52 >>> That could work.  parens are only ever nested 1 deep in that grammar so it is regular and the current parsing would be ok.
53
54 >> Note that I made the "~" explicit, not implicit, so it could be left out. In the case of ambiguity between
55 >> a definition and a page name, the definition would win.
56
57 >>> That was my initial thought too :), but when implementing it I decided that requiring the ~ made things easier.  I'll probably require the ~ for the first pass at least.
58
59 >> So, equivilant example: `define(bugs, bugs/* and !*/Discussion) and define(openbugs, bugs and !link(done)) and openbugs and !link(openbugs)`
60 >> 
61 >> Re recursion, it is avoided.. but building a pagespec that is O(N^X) where N is the
62 >> number of pages in the wiki is not avoided. Probably need to add DOS prevention.
63 >>  --[[Joey]]
64
65 >>> If you memoize the outcomes of the named pagespecs you can make in O(N.X), no?
66 >>> -- [[Will]]
67
68 >>>> Yeah, guess that'd work. :-)
69
70 > One quick further thought.  All the above discussion assumes that 'dependency' is the
71 > same as 'links to', which is not really true.  For example, you'd like to be able to say
72 > "This bug does not depend upon [ [ link to other bug ] ]" and not have a dependency.
73 > Without having different types of links, I don't see how this would be possible.
74 >
75 > -- [[Will]]
76
77 Okie - I've had a quick attempt at this.  Initial patch attached.  This one doesn't quite work.
78 And there is still a lot of debugging stuff in there.
79
80 At the moment I've added a new preprocessor plugin, `definepagespec`, which is like
81 shortcut for pagespecs.  To reference a named pagespec, use `~` like this:
82
83     [ [!definepagespec name="bugs" spec="bugs/* and !*/Discussion"]]
84     [ [!definepagespec name="openbugs" spec="~bugs and !link(done)"]]
85     [ [!definepagespec name="readybugs" spec="~openbugs and !link(~openbugs)"]]
86
87 At the moment the problem is in `match_link()` when we're trying to find a sub-page that
88 matches the appropriate page spec.  There is no good list of pages available to iterate over.
89
90     foreach my $nextpage (keys %IkiWiki::pagesources)
91
92 does not give me a good list of pages.  I found the same thing when I was working on
93 this todo [[todo/Add_a_plugin_to_list_available_pre-processor_commands]].
94
95 > I'm not sure why iterating over `%pagesources` wouldn't work here, it's the same method
96 > used by anything that needs to match a pagespec against all pages..? --[[Joey]]
97
98 >> My uchecked hypothesis is that %pagesources is created after the refresh hook.
99 >> I've also been concerned about how globally defined pagespec shortcuts would interact with
100 >> the page dependancy system.  Your idea of internally defined shortcuts should fix that. -- [[Will]]
101
102 >>> You're correct, the refresh hook is run very early, before pagesources
103 >>> is populated. (It will be partially populated on a refresh, but will
104 >>> not be updated to reflect new pages.) Agree that internally defined
105 >>> seems the way to go. --[[Joey]]
106
107 Immediately below is a patch which seems to basically work.  Lots of debugging code is still there
108 and it needs a cleanup, but I thought it worth posting at this point.  (I was having problems
109 with old style glob lists, so i just switched them off for the moment.)
110
111 The following three inlines work for me with this patch:
112
113     Bugs:
114     
115     [ [!inline pages="define(~bugs, bugs/* and ! */Discussion) and ~bugs" archive="yes"]]
116     
117     OpenBugs:
118     
119     [ [!inline pages="define(~bugs, bugs/* and ! */Discussion) and define(~openbugs,~bugs and !link(done)) and ~openbugs" archive="yes"]]
120     
121     ReadyBugs:
122     
123     [ [!inline pages="define(~bugs, bugs/* and ! */Discussion) and define(~openbugs,~bugs and !link(done)) and define(~readybugs,~openbugs and !link(~openbugs)) and ~readybugs" archive="yes"]]
124
125 > Nice! Could the specfuncsref be passed in %params? I'd like to avoid
126 > needing to change the prototype of every pagespec function, since several
127 > plugins define them too. --[[Joey]]
128
129 >> Maybe - it needs more thought.  I also considered it when I was going though changing all those plugins :).
130 >> My concern was that `%params` can contain other user-defined parameters,
131 >> e.g. `link(target, otherparameter)`, and that means that the specFuncs could be clobbered by a user (or other
132 >> weird security hole).  I thought it better to separate it, but I didn't think about it too hard.  I might move it to
133 >> the first parameter rather than the second.  Ikiwiki is my first real perl hacking and I'm still discovering
134 >> good ways to write things in perl.
135 >>
136 >>>> `%params` contains the parameters passed to `pagespec_match`, not
137 >>>> user-supplied parameters. The user-supplied parameter to a function
138 >>>> like `match_glob()` or `match_link()` is passed in the second positional parameter. --[[Joey]]
139 >>
140 >> What do you think is best to do about `is_globlist()`?  At the moment it requires that the 'second word', as
141 >> delimited by a space and ignoring parens, is 'and' or 'or'.  This doesn't hold in the above example pagespecs (so I just hard wired it to 0 to test my patch).
142 >> My thought was just to search for 'and' or 'or' as words anywhere in the pagespec.  Thoughts?
143
144 >>> Dunno, we could just finish deprecating it. Or change the regexp to
145 >>> skip over spaces in parens. (`/[^\s]+\s+([^)]+)/`) --[[Joey]]
146
147 >> Oh, one more thing.  In pagespec_translate (now pagespec_makeperl), there is a part of the regular expression for `# any other text`.
148 >> This contained `()`, which has no effect.  I replaced that with `\(\)`, but that is a change in the definition of pagespecs unrelated to the
149 >> rest of this patch. In a related change, commands were not able to contain `)` in their parameters.  I've extended that so the cannot
150 >> contain `(` or `)`.  -- [[Will]]
151
152 >>> `[^\s()]+` is a character class matching all characters not spaces or
153 >>> parens. Since the pervious terminals in the regexp consume most
154 >>> occurances of an open paren or close paren, it's unlikely for one to
155 >>> get through to that part of the regexp. For example, "foo()" will be
156 >>> matched by the command matcher; "(foo)" will be matched by the open
157 >>> paren literal terminal. "foo(" and "foo)" can get through to the
158 >>> end, and would be matched as a page name, if it didn't exclude parens.
159 >>>
160 >>> So why exclude them? Well, consider "foo and(bar and baz)". We don't
161 >>> want it to match "and(" as a page name!
162 >>> 
163 >>> Escaping the parens in the character class actually changes nothing; the
164 >>> changed character class still matches all characters not spaces or
165 >>> parens. (Try it!).
166 >>> 
167 >>> Re commands containing '(', I don't really see any reason not to
168 >>> allow that, unless it breaks something. --[[Joey]]
169
170 >>> Updated patch.  Moved the specFuncsRef to the front of the arg list.  Still haven't thought through the security implications of
171 >>> having it in `%params`.  I've also removed all the debugging `print` statements.  And I've updated the `is_globlist()` function.
172 >>> I think this is ready for people other than me to have a play.  It is not well enough tested to commit just yet.
173 >>> -- [[Will]]
174
175 ----
176
177 diff --git a/IkiWiki.pm b/IkiWiki.pm
178 index e476521..532aaf5 100644
179 --- a/IkiWiki.pm
180 +++ b/IkiWiki.pm
181 @@ -1524,7 +1524,16 @@ sub globlist_to_pagespec ($) { #{{{
182  
183  sub is_globlist ($) { #{{{
184         my $s=shift;
185 -       return ( $s =~ /[^\s]+\s+([^\s]+)/ && $1 ne "and" && $1 ne "or" );
186 +       return ! ($s =~ /
187 +                       (^\s*
188 +                               [^\s\(]+                # single item
189 +                                       (\(                     # possibly with parens after it
190 +                                               ([^\)]* # with stuff inside those parens
191 +                                               (\([^\)]*\))*)* # maybe even nested parens
192 +                                       \))?\s*$
193 +                       ) |
194 +                               (\s and \s) | (\s or \s)        # or we find 'and' or 'or' somewhere
195 +                       /x);
196  } #}}}
197  
198  sub safequote ($) { #{{{
199 @@ -1605,7 +1614,7 @@ sub pagespec_merge ($$) { #{{{
200         return "($a) or ($b)";
201  } #}}}
202  
203 -sub pagespec_translate ($) { #{{{
204 +sub pagespec_makeperl ($) { #{{{
205         my $spec=shift;
206  
207         # Support for old-style GlobLists.
208 @@ -1624,9 +1633,11 @@ sub pagespec_translate ($) { #{{{
209                 |
210                         \)              # )
211                 |
212 -                       \w+\([^\)]*\)   # command(params)
213 +                       define\(\s*~\w+\s*,((\([^\(\)]*\)) | ([^\(\)]+))+\)     # define(~specName, spec) - spec can contain parens 1 deep
214 +               |
215 +                       \w+\([^\(\)]*\) # command(params) - params cannot contain parens
216                 |
217 -                       [^\s()]+        # any other text
218 +                       [^\s\(\)]+      # any other text
219                 )
220                 \s*             # ignore whitespace
221         }igx) {
222 @@ -1640,16 +1651,23 @@ sub pagespec_translate ($) { #{{{
223                 elsif ($word eq "(" || $word eq ")" || $word eq "!") {
224                         $code.=' '.$word;
225                 }
226 +               elsif ($word =~ /^define\(\s*~(\w+)\s*,(.*)\)$/) {
227 +                       $code .= " (\$specFuncsRef->{$1}=";
228 +                       $code .= "memoize(";
229 +                       $code .= &pagespec_makeperl($2);
230 +                       $code .= ")";
231 +                       $code .= ") ";
232 +               }
233                 elsif ($word =~ /^(\w+)\((.*)\)$/) {
234                         if (exists $IkiWiki::PageSpec::{"match_$1"}) {
235 -                               $code.="IkiWiki::PageSpec::match_$1(\$page, ".safequote($2).", \@_)";
236 +                               $code.="IkiWiki::PageSpec::match_$1(\$specFuncsRef, \$page, ".safequote($2).", \@_)";
237                         }
238                         else {
239                                 $code.=' 0';
240                         }
241                 }
242                 else {
243 -                       $code.=" IkiWiki::PageSpec::match_glob(\$page, ".safequote($word).", \@_)";
244 +                       $code.=" IkiWiki::PageSpec::match_glob(\$specFuncsRef, \$page, ".safequote($word).", \@_)";
245                 }
246         }
247  
248 @@ -1657,8 +1675,16 @@ sub pagespec_translate ($) { #{{{
249                 $code=0;
250         }
251  
252 +       return 'sub { my $specFuncsRef=shift; my $page=shift; '.$code.' }';
253 +} #}}}
254 +
255 +sub pagespec_translate ($) { #{{{
256 +       my $spec=shift;
257 +
258 +       my $code = pagespec_makeperl($spec);
259 +
260         no warnings;
261 -       return eval 'sub { my $page=shift; '.$code.' }';
262 +       return eval $code;
263  } #}}}
264  
265  sub pagespec_match ($$;@) { #{{{
266 @@ -1673,7 +1699,7 @@ sub pagespec_match ($$;@) { #{{{
267  
268         my $sub=pagespec_translate($spec);
269         return IkiWiki::FailReason->new("syntax error in pagespec \"$spec\"") if $@;
270 -       return $sub->($page, @params);
271 +       return $sub->({}, $page, @params);
272  } #}}}
273  
274  sub pagespec_valid ($) { #{{{
275 @@ -1722,11 +1748,71 @@ sub new { #{{{
276  
277  package IkiWiki::PageSpec;
278  
279 -sub match_glob ($$;@) { #{{{
280 +sub check_named_spec($$$;@) {
281 +       my $specFuncsRef=shift;
282 +       my $page=shift;
283 +       my $specName=shift;
284 +       my %params=@_;
285 +       
286 +       return IkiWiki::FailReason->new("Named page spec '$specName' is not valid")
287 +               unless (substr($specName, 0, 1) eq '~');
288 +       
289 +       $specName = substr($specName, 1);
290 +
291 +       if (exists $specFuncsRef->{$specName}) {
292 +               # remove the named spec from the spec refs
293 +               # when we recurse to avoid infinite recursion
294 +               my $sub = $specFuncsRef->{$specName};
295 +               $specFuncsRef->{$specName} = undef;
296 +               my $result = $sub->($specFuncsRef, $page, %params);
297 +               $specFuncsRef->{$specName} = $sub;
298 +               return $result;
299 +       } else {
300 +               return IkiWiki::FailReason->new("Page spec '$specName' does not exist");
301 +       }
302 +}
303 +
304 +sub check_named_spec_existential($$$$;@) {
305 +       my $specFuncsRef=shift;
306 +       my $page=shift;
307 +       my $specName=shift;
308 +       my $funcref=shift;
309 +       my %params=@_;
310 +       
311 +       return IkiWiki::FailReason->new("Named page spec '$specName' is not valid")
312 +               unless (substr($specName, 0, 1) eq '~');
313 +       $specName = substr($specName, 1);
314 +       
315 +       if (exists $specFuncsRef->{$specName}) {
316 +               # remove the named spec from the spec refs
317 +               # when we recurse to avoid infinite recursion
318 +               my $sub = $specFuncsRef->{$specName};
319 +               $specFuncsRef->{$specName} = undef;
320 +               
321 +               foreach my $nextpage (keys %IkiWiki::pagesources) {
322 +                       if ($sub->($specFuncsRef, $nextpage, %params)) {
323 +                               my $tempResult = $funcref->($specFuncsRef, $page, $nextpage, %params);
324 +                               return $tempResult if ($tempResult);
325 +                       }
326 +               }
327 +               
328 +               $specFuncsRef->{$specName} = $sub;
329 +               return IkiWiki::FailReason->new("No page in spec '$specName' was successfully matched");
330 +       } else {
331 +               return IkiWiki::FailReason->new("Named page spec '$specName' does not exist");
332 +       }
333 +}
334 +
335 +sub match_glob ($$$;@) { #{{{
336 +       my $specFuncsRef=shift;
337         my $page=shift;
338         my $glob=shift;
339         my %params=@_;
340         
341 +       if (substr($glob, 0, 1) eq '~') {
342 +               return check_named_spec($specFuncsRef, $page, $glob);
343 +       }
344 +
345         my $from=exists $params{location} ? $params{location} : '';
346         
347         # relative matching
348 @@ -1750,17 +1836,23 @@ sub match_glob ($$;@) { #{{{
349         }
350  } #}}}
351  
352 -sub match_internal ($$;@) { #{{{
353 -       return match_glob($_[0], $_[1], @_, internal => 1)
354 +sub match_internal ($$$;@) { #{{{
355 +       return match_glob(shift, shift, shift, @_, internal => 1)
356  } #}}}
357  
358 -sub match_link ($$;@) { #{{{
359 +sub match_link ($$$;@) { #{{{
360 +       my $specFuncsRef=shift;
361         my $page=shift;
362 -       my $link=lc(shift);
363 +       my $fulllink=shift;
364 +       my $link=lc($fulllink);
365         my %params=@_;
366  
367 -       my $from=exists $params{location} ? $params{location} : '';
368 +       if (substr($fulllink, 0, 1) eq '~') {
369 +               return check_named_spec_existential($specFuncsRef, $page, $fulllink, \&match_link);
370 +       }
371  
372 +       my $from=exists $params{location} ? $params{location} : '';
373 +       
374         # relative matching
375         if ($link =~ m!^\.! && defined $from) {
376                 $from=~s#/?[^/]+$##;
377 @@ -1778,17 +1870,21 @@ sub match_link ($$;@) { #{{{
378                 }
379                 else {
380                         return IkiWiki::SuccessReason->new("$page links to page $p matching $link")
381 -                               if match_glob($p, $link, %params);
382 +                               if match_glob($specFuncsRef, $p, $link, %params);
383                 }
384         }
385         return IkiWiki::FailReason->new("$page does not link to $link");
386  } #}}}
387  
388 -sub match_backlink ($$;@) { #{{{
389 -       return match_link($_[1], $_[0], @_);
390 +sub match_backlink ($$$;@) { #{{{
391 +       my $specFuncsRef=shift;
392 +       my $page=shift;
393 +       my $backlink=shift;
394 +       return match_link($specFuncsRef, $backlink, $page, @_);
395  } #}}}
396  
397 -sub match_created_before ($$;@) { #{{{
398 +sub match_created_before ($$$;@) { #{{{
399 +       my $specFuncsRef=shift;
400         my $page=shift;
401         my $testpage=shift;
402  
403 @@ -1805,7 +1901,8 @@ sub match_created_before ($$;@) { #{{{
404         }
405  } #}}}
406  
407 -sub match_created_after ($$;@) { #{{{
408 +sub match_created_after ($$$;@) { #{{{
409 +       my $specFuncsRef=shift;
410         my $page=shift;
411         my $testpage=shift;
412  
413 @@ -1822,8 +1919,12 @@ sub match_created_after ($$;@) { #{{{
414         }
415  } #}}}
416  
417 -sub match_creation_day ($$;@) { #{{{
418 -       if ((gmtime($IkiWiki::pagectime{shift()}))[3] == shift) {
419 +sub match_creation_day ($$$;@) { #{{{
420 +       shift;
421 +       my $page=shift;
422 +       my $time=shift;
423 +
424 +       if ((gmtime($IkiWiki::pagectime{$page}))[3] == $time) {
425                 return IkiWiki::SuccessReason->new('creation_day matched');
426         }
427         else {
428 @@ -1831,8 +1932,12 @@ sub match_creation_day ($$;@) { #{{{
429         }
430  } #}}}
431  
432 -sub match_creation_month ($$;@) { #{{{
433 -       if ((gmtime($IkiWiki::pagectime{shift()}))[4] + 1 == shift) {
434 +sub match_creation_month ($$$;@) { #{{{
435 +       shift;
436 +       my $page=shift;
437 +       my $time=shift;
438 +
439 +       if ((gmtime($IkiWiki::pagectime{$page}))[4] + 1 == $time) {
440                 return IkiWiki::SuccessReason->new('creation_month matched');
441         }
442         else {
443 @@ -1840,8 +1945,12 @@ sub match_creation_month ($$;@) { #{{{
444         }
445  } #}}}
446  
447 -sub match_creation_year ($$;@) { #{{{
448 -       if ((gmtime($IkiWiki::pagectime{shift()}))[5] + 1900 == shift) {
449 +sub match_creation_year ($$$;@) { #{{{
450 +       shift;
451 +       my $page=shift;
452 +       my $time=shift;
453 +
454 +       if ((gmtime($IkiWiki::pagectime{$page}))[5] + 1900 == $time) {
455                 return IkiWiki::SuccessReason->new('creation_year matched');
456         }
457         else {
458 diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm
459 index f1f792a..a410e48 100644
460 --- a/IkiWiki/Plugin/attachment.pm
461 +++ b/IkiWiki/Plugin/attachment.pm
462 @@ -291,7 +291,8 @@ sub attachment_list ($) { #{{{
463  
464  package IkiWiki::PageSpec;
465  
466 -sub match_user ($$;@) { #{{{
467 +sub match_user ($$$;@) { #{{{
468 +       shift;
469         shift;
470         my $user=shift;
471         my %params=@_;
472 @@ -311,7 +312,8 @@ sub match_user ($$;@) { #{{{
473         }
474  } #}}}
475  
476 -sub match_ip ($$;@) { #{{{
477 +sub match_ip ($$$;@) { #{{{
478 +       shift;
479         shift;
480         my $ip=shift;
481         my %params=@_;
482 diff --git a/IkiWiki/Plugin/conditional.pm b/IkiWiki/Plugin/conditional.pm
483 index 7716fce..c0dbb50 100644
484 --- a/IkiWiki/Plugin/conditional.pm
485 +++ b/IkiWiki/Plugin/conditional.pm
486 @@ -70,7 +70,8 @@ sub preprocess_if (@) { #{{{
487  
488  package IkiWiki::PageSpec;
489  
490 -sub match_enabled ($$;@) { #{{{
491 +sub match_enabled ($$$;@) { #{{{
492 +       shift;
493         shift;
494         my $plugin=shift;
495         
496 @@ -83,13 +84,14 @@ sub match_enabled ($$;@) { #{{{
497         }
498  } #}}}
499  
500 -sub match_sourcepage ($$;@) { #{{{
501 +sub match_sourcepage ($$$;@) { #{{{
502 +       my $specFuncsRef=shift;
503         shift;
504         my $glob=shift;
505         my %params=@_;
506  
507         return IkiWiki::FailReason->new("cannot match sourcepage") unless exists $params{sourcepage};
508 -       if (match_glob($params{sourcepage}, $glob, @_)) {
509 +       if (match_glob($specFuncsRef, $params{sourcepage}, $glob, @_)) {
510                 return IkiWiki::SuccessReason->new("sourcepage matches $glob");
511         }
512         else {
513 @@ -97,13 +99,14 @@ sub match_sourcepage ($$;@) { #{{{
514         }
515  } #}}}
516  
517 -sub match_destpage ($$;@) { #{{{
518 +sub match_destpage ($$$;@) { #{{{
519 +       my $specFuncsRef=shift;
520         shift;
521         my $glob=shift;
522         my %params=@_;
523         
524         return IkiWiki::FailReason->new("cannot match destpage") unless exists $params{destpage};
525 -       if (match_glob($params{destpage}, $glob, @_)) {
526 +       if (match_glob($specFuncsRef, $params{destpage}, $glob, @_)) {
527                 return IkiWiki::SuccessReason->new("destpage matches $glob");
528         }
529         else {
530 @@ -111,7 +114,8 @@ sub match_destpage ($$;@) { #{{{
531         }
532  } #}}}
533  
534 -sub match_included ($$;@) { #{{{
535 +sub match_included ($$$;@) { #{{{
536 +       shift;
537         shift;
538         shift;
539         my %params=@_;
540 diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm
541 index 6f71be3..3592342 100644
542 --- a/IkiWiki/Plugin/filecheck.pm
543 +++ b/IkiWiki/Plugin/filecheck.pm
544 @@ -66,7 +66,8 @@ sub humansize ($) { #{{{
545  
546  package IkiWiki::PageSpec;
547  
548 -sub match_maxsize ($$;@) { #{{{
549 +sub match_maxsize ($$$;@) { #{{{
550 +       shift;
551         my $page=shift;
552         my $maxsize=eval{IkiWiki::Plugin::attachment::parsesize(shift)};
553         if ($@) {
554 @@ -87,7 +88,8 @@ sub match_maxsize ($$;@) { #{{{
555         }
556  } #}}}
557  
558 -sub match_minsize ($$;@) { #{{{
559 +sub match_minsize ($$$;@) { #{{{
560 +       shift;
561         my $page=shift;
562         my $minsize=eval{IkiWiki::Plugin::attachment::parsesize(shift)};
563         if ($@) {
564 @@ -108,7 +110,8 @@ sub match_minsize ($$;@) { #{{{
565         }
566  } #}}}
567  
568 -sub match_mimetype ($$;@) { #{{{
569 +sub match_mimetype ($$$;@) { #{{{
570 +       shift;
571         my $page=shift;
572         my $wanted=shift;
573  
574 @@ -138,7 +141,8 @@ sub match_mimetype ($$;@) { #{{{
575         }
576  } #}}}
577  
578 -sub match_virusfree ($$;@) { #{{{
579 +sub match_virusfree ($$$;@) { #{{{
580 +       shift;
581         my $page=shift;
582         my $wanted=shift;
583  
584 @@ -180,7 +184,7 @@ sub match_virusfree ($$;@) { #{{{
585         }
586  } #}}}
587  
588 -sub match_ispage ($$;@) { #{{{
589 +sub match_ispage ($$$;@) { #{{{
590         my $filename=shift;
591  
592         if (defined IkiWiki::pagetype($filename)) {
593 diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
594 index b2c85c8..788f248 100644
595 --- a/IkiWiki/Plugin/meta.pm
596 +++ b/IkiWiki/Plugin/meta.pm
597 @@ -263,6 +263,7 @@ sub pagetemplate (@) { #{{{
598  
599  sub match { #{{{
600         my $field=shift;
601 +       shift;
602         my $page=shift;
603         
604         # turn glob into a safe regexp
605 @@ -291,23 +292,23 @@ sub match { #{{{
606  
607  package IkiWiki::PageSpec;
608  
609 -sub match_title ($$;@) { #{{{
610 +sub match_title ($$$;@) { #{{{
611         IkiWiki::Plugin::meta::match("title", @_);      
612  } #}}}
613  
614 -sub match_author ($$;@) { #{{{
615 +sub match_author ($$$;@) { #{{{
616         IkiWiki::Plugin::meta::match("author", @_);
617  } #}}}
618  
619 -sub match_authorurl ($$;@) { #{{{
620 +sub match_authorurl ($$$;@) { #{{{
621         IkiWiki::Plugin::meta::match("authorurl", @_);
622  } #}}}
623  
624 -sub match_license ($$;@) { #{{{
625 +sub match_license ($$$;@) { #{{{
626         IkiWiki::Plugin::meta::match("license", @_);
627  } #}}}
628  
629 -sub match_copyright ($$;@) { #{{{
630 +sub match_copyright ($$$;@) { #{{{
631         IkiWiki::Plugin::meta::match("copyright", @_);
632  } #}}}
633