]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/tracking_bugs_with_dependencies.mdwn
Updated patch
[ikiwiki.git] / 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 >> What do you think is best to do about `is_globlist()`?  At the moment it requires that the 'second word', as
137 >> 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).
138 >> My thought was just to search for 'and' or 'or' as words anywhere in the pagespec.  Thoughts?
139
140 >> Oh, one more thing.  In pagespec_translate (now pagespec_makeperl), there is a part of the regular expression for `# any other text`.
141 >> This contained `()`, which has no effect.  I replaced that with `\(\)`, but that is a change in the definition of pagespecs unrelated to the
142 >> rest of this patch. In a related change, commands were not able to contain `)` in their parameters.  I've extended that so the cannot
143 >> contain `(` or `)`.  -- [[Will]]
144
145 >>> Updated patch.  Moved the specFuncsRef to the front of the arg list.  Still haven't thought through the security implications of
146 >>> having it in `%params`.  I've also removed all the debugging `print` statements.  And I've updated the `is_globlist()` function.
147 >>> I think this is ready for people other than me to have a play.  It is not well enough tested to commit just yet.
148 >>> -- [[Will]]
149
150 ----
151
152 diff --git a/IkiWiki.pm b/IkiWiki.pm
153 index e476521..532aaf5 100644
154 --- a/IkiWiki.pm
155 +++ b/IkiWiki.pm
156 @@ -1524,7 +1524,16 @@ sub globlist_to_pagespec ($) { #{{{
157  
158  sub is_globlist ($) { #{{{
159         my $s=shift;
160 -       return ( $s =~ /[^\s]+\s+([^\s]+)/ && $1 ne "and" && $1 ne "or" );
161 +       return ! ($s =~ /
162 +                       (^\s*
163 +                               [^\s\(]+                # single item
164 +                                       (\(                     # possibly with parens after it
165 +                                               ([^\)]* # with stuff inside those parens
166 +                                               (\([^\)]*\))*)* # maybe even nested parens
167 +                                       \))?\s*$
168 +                       ) |
169 +                               (\s and \s) | (\s or \s)        # or we find 'and' or 'or' somewhere
170 +                       /x);
171  } #}}}
172  
173  sub safequote ($) { #{{{
174 @@ -1605,7 +1614,7 @@ sub pagespec_merge ($$) { #{{{
175         return "($a) or ($b)";
176  } #}}}
177  
178 -sub pagespec_translate ($) { #{{{
179 +sub pagespec_makeperl ($) { #{{{
180         my $spec=shift;
181  
182         # Support for old-style GlobLists.
183 @@ -1624,9 +1633,11 @@ sub pagespec_translate ($) { #{{{
184                 |
185                         \)              # )
186                 |
187 -                       \w+\([^\)]*\)   # command(params)
188 +                       define\(\s*~\w+\s*,((\([^\(\)]*\)) | ([^\(\)]+))+\)     # define(~specName, spec) - spec can contain parens 1 deep
189 +               |
190 +                       \w+\([^\(\)]*\) # command(params) - params cannot contain parens
191                 |
192 -                       [^\s()]+        # any other text
193 +                       [^\s\(\)]+      # any other text
194                 )
195                 \s*             # ignore whitespace
196         }igx) {
197 @@ -1640,16 +1651,23 @@ sub pagespec_translate ($) { #{{{
198                 elsif ($word eq "(" || $word eq ")" || $word eq "!") {
199                         $code.=' '.$word;
200                 }
201 +               elsif ($word =~ /^define\(\s*~(\w+)\s*,(.*)\)$/) {
202 +                       $code .= " (\$specFuncsRef->{$1}=";
203 +                       $code .= "memoize(";
204 +                       $code .= &pagespec_makeperl($2);
205 +                       $code .= ")";
206 +                       $code .= ") ";
207 +               }
208                 elsif ($word =~ /^(\w+)\((.*)\)$/) {
209                         if (exists $IkiWiki::PageSpec::{"match_$1"}) {
210 -                               $code.="IkiWiki::PageSpec::match_$1(\$page, ".safequote($2).", \@_)";
211 +                               $code.="IkiWiki::PageSpec::match_$1(\$specFuncsRef, \$page, ".safequote($2).", \@_)";
212                         }
213                         else {
214                                 $code.=' 0';
215                         }
216                 }
217                 else {
218 -                       $code.=" IkiWiki::PageSpec::match_glob(\$page, ".safequote($word).", \@_)";
219 +                       $code.=" IkiWiki::PageSpec::match_glob(\$specFuncsRef, \$page, ".safequote($word).", \@_)";
220                 }
221         }
222  
223 @@ -1657,8 +1675,16 @@ sub pagespec_translate ($) { #{{{
224                 $code=0;
225         }
226  
227 +       return 'sub { my $specFuncsRef=shift; my $page=shift; '.$code.' }';
228 +} #}}}
229 +
230 +sub pagespec_translate ($) { #{{{
231 +       my $spec=shift;
232 +
233 +       my $code = pagespec_makeperl($spec);
234 +
235         no warnings;
236 -       return eval 'sub { my $page=shift; '.$code.' }';
237 +       return eval $code;
238  } #}}}
239  
240  sub pagespec_match ($$;@) { #{{{
241 @@ -1673,7 +1699,7 @@ sub pagespec_match ($$;@) { #{{{
242  
243         my $sub=pagespec_translate($spec);
244         return IkiWiki::FailReason->new("syntax error in pagespec \"$spec\"") if $@;
245 -       return $sub->($page, @params);
246 +       return $sub->({}, $page, @params);
247  } #}}}
248  
249  sub pagespec_valid ($) { #{{{
250 @@ -1722,11 +1748,71 @@ sub new { #{{{
251  
252  package IkiWiki::PageSpec;
253  
254 -sub match_glob ($$;@) { #{{{
255 +sub check_named_spec($$$;@) {
256 +       my $specFuncsRef=shift;
257 +       my $page=shift;
258 +       my $specName=shift;
259 +       my %params=@_;
260 +       
261 +       return IkiWiki::FailReason->new("Named page spec '$specName' is not valid")
262 +               unless (substr($specName, 0, 1) eq '~');
263 +       
264 +       $specName = substr($specName, 1);
265 +
266 +       if (exists $specFuncsRef->{$specName}) {
267 +               # remove the named spec from the spec refs
268 +               # when we recurse to avoid infinite recursion
269 +               my $sub = $specFuncsRef->{$specName};
270 +               $specFuncsRef->{$specName} = undef;
271 +               my $result = $sub->($specFuncsRef, $page, %params);
272 +               $specFuncsRef->{$specName} = $sub;
273 +               return $result;
274 +       } else {
275 +               return IkiWiki::FailReason->new("Page spec '$specName' does not exist");
276 +       }
277 +}
278 +
279 +sub check_named_spec_existential($$$$;@) {
280 +       my $specFuncsRef=shift;
281 +       my $page=shift;
282 +       my $specName=shift;
283 +       my $funcref=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 +       $specName = substr($specName, 1);
289 +       
290 +       if (exists $specFuncsRef->{$specName}) {
291 +               # remove the named spec from the spec refs
292 +               # when we recurse to avoid infinite recursion
293 +               my $sub = $specFuncsRef->{$specName};
294 +               $specFuncsRef->{$specName} = undef;
295 +               
296 +               foreach my $nextpage (keys %IkiWiki::pagesources) {
297 +                       if ($sub->($specFuncsRef, $nextpage, %params)) {
298 +                               my $tempResult = $funcref->($specFuncsRef, $page, $nextpage, %params);
299 +                               return $tempResult if ($tempResult);
300 +                       }
301 +               }
302 +               
303 +               $specFuncsRef->{$specName} = $sub;
304 +               return IkiWiki::FailReason->new("No page in spec '$specName' was successfully matched");
305 +       } else {
306 +               return IkiWiki::FailReason->new("Named page spec '$specName' does not exist");
307 +       }
308 +}
309 +
310 +sub match_glob ($$$;@) { #{{{
311 +       my $specFuncsRef=shift;
312         my $page=shift;
313         my $glob=shift;
314         my %params=@_;
315         
316 +       if (substr($glob, 0, 1) eq '~') {
317 +               return check_named_spec($specFuncsRef, $page, $glob);
318 +       }
319 +
320         my $from=exists $params{location} ? $params{location} : '';
321         
322         # relative matching
323 @@ -1750,17 +1836,23 @@ sub match_glob ($$;@) { #{{{
324         }
325  } #}}}
326  
327 -sub match_internal ($$;@) { #{{{
328 -       return match_glob($_[0], $_[1], @_, internal => 1)
329 +sub match_internal ($$$;@) { #{{{
330 +       return match_glob(shift, shift, shift, @_, internal => 1)
331  } #}}}
332  
333 -sub match_link ($$;@) { #{{{
334 +sub match_link ($$$;@) { #{{{
335 +       my $specFuncsRef=shift;
336         my $page=shift;
337 -       my $link=lc(shift);
338 +       my $fulllink=shift;
339 +       my $link=lc($fulllink);
340         my %params=@_;
341  
342 -       my $from=exists $params{location} ? $params{location} : '';
343 +       if (substr($fulllink, 0, 1) eq '~') {
344 +               return check_named_spec_existential($specFuncsRef, $page, $fulllink, \&match_link);
345 +       }
346  
347 +       my $from=exists $params{location} ? $params{location} : '';
348 +       
349         # relative matching
350         if ($link =~ m!^\.! && defined $from) {
351                 $from=~s#/?[^/]+$##;
352 @@ -1778,17 +1870,21 @@ sub match_link ($$;@) { #{{{
353                 }
354                 else {
355                         return IkiWiki::SuccessReason->new("$page links to page $p matching $link")
356 -                               if match_glob($p, $link, %params);
357 +                               if match_glob($specFuncsRef, $p, $link, %params);
358                 }
359         }
360         return IkiWiki::FailReason->new("$page does not link to $link");
361  } #}}}
362  
363 -sub match_backlink ($$;@) { #{{{
364 -       return match_link($_[1], $_[0], @_);
365 +sub match_backlink ($$$;@) { #{{{
366 +       my $specFuncsRef=shift;
367 +       my $page=shift;
368 +       my $backlink=shift;
369 +       return match_link($specFuncsRef, $backlink, $page, @_);
370  } #}}}
371  
372 -sub match_created_before ($$;@) { #{{{
373 +sub match_created_before ($$$;@) { #{{{
374 +       my $specFuncsRef=shift;
375         my $page=shift;
376         my $testpage=shift;
377  
378 @@ -1805,7 +1901,8 @@ sub match_created_before ($$;@) { #{{{
379         }
380  } #}}}
381  
382 -sub match_created_after ($$;@) { #{{{
383 +sub match_created_after ($$$;@) { #{{{
384 +       my $specFuncsRef=shift;
385         my $page=shift;
386         my $testpage=shift;
387  
388 @@ -1822,8 +1919,12 @@ sub match_created_after ($$;@) { #{{{
389         }
390  } #}}}
391  
392 -sub match_creation_day ($$;@) { #{{{
393 -       if ((gmtime($IkiWiki::pagectime{shift()}))[3] == shift) {
394 +sub match_creation_day ($$$;@) { #{{{
395 +       shift;
396 +       my $page=shift;
397 +       my $time=shift;
398 +
399 +       if ((gmtime($IkiWiki::pagectime{$page}))[3] == $time) {
400                 return IkiWiki::SuccessReason->new('creation_day matched');
401         }
402         else {
403 @@ -1831,8 +1932,12 @@ sub match_creation_day ($$;@) { #{{{
404         }
405  } #}}}
406  
407 -sub match_creation_month ($$;@) { #{{{
408 -       if ((gmtime($IkiWiki::pagectime{shift()}))[4] + 1 == shift) {
409 +sub match_creation_month ($$$;@) { #{{{
410 +       shift;
411 +       my $page=shift;
412 +       my $time=shift;
413 +
414 +       if ((gmtime($IkiWiki::pagectime{$page}))[4] + 1 == $time) {
415                 return IkiWiki::SuccessReason->new('creation_month matched');
416         }
417         else {
418 @@ -1840,8 +1945,12 @@ sub match_creation_month ($$;@) { #{{{
419         }
420  } #}}}
421  
422 -sub match_creation_year ($$;@) { #{{{
423 -       if ((gmtime($IkiWiki::pagectime{shift()}))[5] + 1900 == shift) {
424 +sub match_creation_year ($$$;@) { #{{{
425 +       shift;
426 +       my $page=shift;
427 +       my $time=shift;
428 +
429 +       if ((gmtime($IkiWiki::pagectime{$page}))[5] + 1900 == $time) {
430                 return IkiWiki::SuccessReason->new('creation_year matched');
431         }
432         else {
433 diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm
434 index f1f792a..a410e48 100644
435 --- a/IkiWiki/Plugin/attachment.pm
436 +++ b/IkiWiki/Plugin/attachment.pm
437 @@ -291,7 +291,8 @@ sub attachment_list ($) { #{{{
438  
439  package IkiWiki::PageSpec;
440  
441 -sub match_user ($$;@) { #{{{
442 +sub match_user ($$$;@) { #{{{
443 +       shift;
444         shift;
445         my $user=shift;
446         my %params=@_;
447 @@ -311,7 +312,8 @@ sub match_user ($$;@) { #{{{
448         }
449  } #}}}
450  
451 -sub match_ip ($$;@) { #{{{
452 +sub match_ip ($$$;@) { #{{{
453 +       shift;
454         shift;
455         my $ip=shift;
456         my %params=@_;
457 diff --git a/IkiWiki/Plugin/conditional.pm b/IkiWiki/Plugin/conditional.pm
458 index 7716fce..c0dbb50 100644
459 --- a/IkiWiki/Plugin/conditional.pm
460 +++ b/IkiWiki/Plugin/conditional.pm
461 @@ -70,7 +70,8 @@ sub preprocess_if (@) { #{{{
462  
463  package IkiWiki::PageSpec;
464  
465 -sub match_enabled ($$;@) { #{{{
466 +sub match_enabled ($$$;@) { #{{{
467 +       shift;
468         shift;
469         my $plugin=shift;
470         
471 @@ -83,13 +84,14 @@ sub match_enabled ($$;@) { #{{{
472         }
473  } #}}}
474  
475 -sub match_sourcepage ($$;@) { #{{{
476 +sub match_sourcepage ($$$;@) { #{{{
477 +       my $specFuncsRef=shift;
478         shift;
479         my $glob=shift;
480         my %params=@_;
481  
482         return IkiWiki::FailReason->new("cannot match sourcepage") unless exists $params{sourcepage};
483 -       if (match_glob($params{sourcepage}, $glob, @_)) {
484 +       if (match_glob($specFuncsRef, $params{sourcepage}, $glob, @_)) {
485                 return IkiWiki::SuccessReason->new("sourcepage matches $glob");
486         }
487         else {
488 @@ -97,13 +99,14 @@ sub match_sourcepage ($$;@) { #{{{
489         }
490  } #}}}
491  
492 -sub match_destpage ($$;@) { #{{{
493 +sub match_destpage ($$$;@) { #{{{
494 +       my $specFuncsRef=shift;
495         shift;
496         my $glob=shift;
497         my %params=@_;
498         
499         return IkiWiki::FailReason->new("cannot match destpage") unless exists $params{destpage};
500 -       if (match_glob($params{destpage}, $glob, @_)) {
501 +       if (match_glob($specFuncsRef, $params{destpage}, $glob, @_)) {
502                 return IkiWiki::SuccessReason->new("destpage matches $glob");
503         }
504         else {
505 @@ -111,7 +114,8 @@ sub match_destpage ($$;@) { #{{{
506         }
507  } #}}}
508  
509 -sub match_included ($$;@) { #{{{
510 +sub match_included ($$$;@) { #{{{
511 +       shift;
512         shift;
513         shift;
514         my %params=@_;
515 diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm
516 index 6f71be3..3592342 100644
517 --- a/IkiWiki/Plugin/filecheck.pm
518 +++ b/IkiWiki/Plugin/filecheck.pm
519 @@ -66,7 +66,8 @@ sub humansize ($) { #{{{
520  
521  package IkiWiki::PageSpec;
522  
523 -sub match_maxsize ($$;@) { #{{{
524 +sub match_maxsize ($$$;@) { #{{{
525 +       shift;
526         my $page=shift;
527         my $maxsize=eval{IkiWiki::Plugin::attachment::parsesize(shift)};
528         if ($@) {
529 @@ -87,7 +88,8 @@ sub match_maxsize ($$;@) { #{{{
530         }
531  } #}}}
532  
533 -sub match_minsize ($$;@) { #{{{
534 +sub match_minsize ($$$;@) { #{{{
535 +       shift;
536         my $page=shift;
537         my $minsize=eval{IkiWiki::Plugin::attachment::parsesize(shift)};
538         if ($@) {
539 @@ -108,7 +110,8 @@ sub match_minsize ($$;@) { #{{{
540         }
541  } #}}}
542  
543 -sub match_mimetype ($$;@) { #{{{
544 +sub match_mimetype ($$$;@) { #{{{
545 +       shift;
546         my $page=shift;
547         my $wanted=shift;
548  
549 @@ -138,7 +141,8 @@ sub match_mimetype ($$;@) { #{{{
550         }
551  } #}}}
552  
553 -sub match_virusfree ($$;@) { #{{{
554 +sub match_virusfree ($$$;@) { #{{{
555 +       shift;
556         my $page=shift;
557         my $wanted=shift;
558  
559 @@ -180,7 +184,7 @@ sub match_virusfree ($$;@) { #{{{
560         }
561  } #}}}
562  
563 -sub match_ispage ($$;@) { #{{{
564 +sub match_ispage ($$$;@) { #{{{
565         my $filename=shift;
566  
567         if (defined IkiWiki::pagetype($filename)) {
568 diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
569 index b2c85c8..788f248 100644
570 --- a/IkiWiki/Plugin/meta.pm
571 +++ b/IkiWiki/Plugin/meta.pm
572 @@ -263,6 +263,7 @@ sub pagetemplate (@) { #{{{
573  
574  sub match { #{{{
575         my $field=shift;
576 +       shift;
577         my $page=shift;
578         
579         # turn glob into a safe regexp
580 @@ -291,23 +292,23 @@ sub match { #{{{
581  
582  package IkiWiki::PageSpec;
583  
584 -sub match_title ($$;@) { #{{{
585 +sub match_title ($$$;@) { #{{{
586         IkiWiki::Plugin::meta::match("title", @_);      
587  } #}}}
588  
589 -sub match_author ($$;@) { #{{{
590 +sub match_author ($$$;@) { #{{{
591         IkiWiki::Plugin::meta::match("author", @_);
592  } #}}}
593  
594 -sub match_authorurl ($$;@) { #{{{
595 +sub match_authorurl ($$$;@) { #{{{
596         IkiWiki::Plugin::meta::match("authorurl", @_);
597  } #}}}
598  
599 -sub match_license ($$;@) { #{{{
600 +sub match_license ($$$;@) { #{{{
601         IkiWiki::Plugin::meta::match("license", @_);
602  } #}}}
603  
604 -sub match_copyright ($$;@) { #{{{
605 +sub match_copyright ($$$;@) { #{{{
606         IkiWiki::Plugin::meta::match("copyright", @_);
607  } #}}}
608