]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/tracking_bugs_with_dependencies.mdwn
filecheck: Fixed two bits broken in move from attachment.
[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 ----
146
147 diff --git a/IkiWiki.pm b/IkiWiki.pm
148 index e476521..07b71d7 100644
149 --- a/IkiWiki.pm
150 +++ b/IkiWiki.pm
151 @@ -1524,7 +1524,7 @@ sub globlist_to_pagespec ($) { #{{{
152  
153  sub is_globlist ($) { #{{{
154         my $s=shift;
155 -       return ( $s =~ /[^\s]+\s+([^\s]+)/ && $1 ne "and" && $1 ne "or" );
156 +       return 0; #( $s =~ /[^\s]+\s+([^\s]+)/ && $1 ne "and" && $1 ne "or" );
157  } #}}}
158  
159  sub safequote ($) { #{{{
160 @@ -1605,7 +1605,7 @@ sub pagespec_merge ($$) { #{{{
161         return "($a) or ($b)";
162  } #}}}
163  
164 -sub pagespec_translate ($) { #{{{
165 +sub pagespec_makeperl ($) { #{{{
166         my $spec=shift;
167  
168         # Support for old-style GlobLists.
169 @@ -1624,9 +1624,11 @@ sub pagespec_translate ($) { #{{{
170                 |
171                         \)              # )
172                 |
173 -                       \w+\([^\)]*\)   # command(params)
174 +                       define\(\s*~\w+\s*,((\([^\(\)]*\)) | ([^\(\)]+))+\)     # define(~specName, spec) - spec can contain parens 1 deep
175 +               |
176 +                       \w+\([^\(\)]*\) # command(params) - params cannot contain parens
177                 |
178 -                       [^\s()]+        # any other text
179 +                       [^\s\(\)]+      # any other text
180                 )
181                 \s*             # ignore whitespace
182         }igx) {
183 @@ -1640,16 +1642,23 @@ sub pagespec_translate ($) { #{{{
184                 elsif ($word eq "(" || $word eq ")" || $word eq "!") {
185                         $code.=' '.$word;
186                 }
187 +               elsif ($word =~ /^define\(\s*~(\w+)\s*,(.*)\)$/) {
188 +                       $code .= " (\$specFuncsRef->{$1}=";
189 +                       #$code .= "memoize(";
190 +                       $code .= pagespec_makeperl($2);
191 +                       #$code .= ")";
192 +                       $code .= ") ";
193 +               }
194                 elsif ($word =~ /^(\w+)\((.*)\)$/) {
195                         if (exists $IkiWiki::PageSpec::{"match_$1"}) {
196 -                               $code.="IkiWiki::PageSpec::match_$1(\$page, ".safequote($2).", \@_)";
197 +                               $code.="IkiWiki::PageSpec::match_$1(\$page, \$specFuncsRef, ".safequote($2).", \@_)";
198                         }
199                         else {
200                                 $code.=' 0';
201                         }
202                 }
203                 else {
204 -                       $code.=" IkiWiki::PageSpec::match_glob(\$page, ".safequote($word).", \@_)";
205 +                       $code.=" IkiWiki::PageSpec::match_glob(\$page, \$specFuncsRef, ".safequote($word).", \@_)";
206                 }
207         }
208  
209 @@ -1657,8 +1666,18 @@ sub pagespec_translate ($) { #{{{
210                 $code=0;
211         }
212  
213 +       return 'sub { my $page=shift; my $specFuncsRef=shift; '.$code.' }';
214 +} #}}}
215 +
216 +sub pagespec_translate ($) { #{{{
217 +       my $spec=shift;
218 +
219 +       my $code = pagespec_makeperl($spec);
220 +
221 +       print "Spec '$spec' led to perl '$code'\n";
222 +
223         no warnings;
224 -       return eval 'sub { my $page=shift; '.$code.' }';
225 +       return eval $code;
226  } #}}}
227  
228  sub pagespec_match ($$;@) { #{{{
229 @@ -1673,7 +1692,7 @@ sub pagespec_match ($$;@) { #{{{
230  
231         my $sub=pagespec_translate($spec);
232         return IkiWiki::FailReason->new("syntax error in pagespec \"$spec\"") if $@;
233 -       return $sub->($page, @params);
234 +       return $sub->($page, {}, @params);
235  } #}}}
236  
237  sub pagespec_valid ($) { #{{{
238 @@ -1722,13 +1741,77 @@ sub new { #{{{
239  
240  package IkiWiki::PageSpec;
241  
242 -sub match_glob ($$;@) { #{{{
243 +sub check_named_spec($$$;@) {
244 +       my $page=shift;
245 +       my $specFuncsRef=shift;
246 +       my $specName=shift;
247 +       my %params=@_;
248 +       
249 +       return IkiWiki::FailReason->new("Named page spec '$specName' is not valid")
250 +               unless (substr($specName, 0, 1) eq '~');
251 +       
252 +       $specName = substr($specName, 1);
253 +       print "Checking pagespec named $specName against page $page\n";
254 +       if (exists $specFuncsRef->{$specName}) {
255 +               # remove the named spec from the spec refs
256 +               # when we recurse to avoid infinite recursion
257 +               my $sub = $specFuncsRef->{$specName};
258 +               $specFuncsRef->{$specName} = undef;
259 +               my $result = $sub->($page, $specFuncsRef, %params);
260 +               $specFuncsRef->{$specName} = $sub;
261 +               return $result;
262 +       } else {
263 +               print "Couldn't find pagespec\n";
264 +               return IkiWiki::FailReason->new("Page spec $specName does not exist");
265 +       }
266 +}
267 +
268 +sub check_named_spec_existential($$$$;@) {
269 +       my $page=shift;
270 +       my $specFuncsRef=shift;
271 +       my $specName=shift;
272 +       my $funcref=shift;
273 +       my %params=@_;
274 +       
275 +       return IkiWiki::FailReason->new("Named page spec '$specName' is not valid")
276 +               unless (substr($specName, 0, 1) eq '~');
277 +       $specName = substr($specName, 1);
278 +       
279 +       print "Checking (existential) pagespec named $specName against page $page\n";
280 +       
281 +       if (exists $specFuncsRef->{$specName}) {
282 +               # remove the named spec from the spec refs
283 +               # when we recurse to avoid infinite recursion
284 +               my $sub = $specFuncsRef->{$specName};
285 +               $specFuncsRef->{$specName} = undef;
286 +               
287 +               foreach my $nextpage (keys %IkiWiki::pagesources) {
288 +                       print "Checking $nextpage against $specName\n";
289 +                       if ($sub->($nextpage, $specFuncsRef, %params)) {
290 +                               print "Match!  Checking spec $nextpage against function from original page $page\n";
291 +                               my $tempResult = $funcref->($page, $specFuncsRef, $nextpage, %params);
292 +                               return $tempResult if ($tempResult);
293 +                       }
294 +               }
295 +               
296 +               $specFuncsRef->{$specName} = $sub;
297 +               return IkiWiki::FailReason->new("No page in spec $specName was successfully matched");
298 +       } else {
299 +               print "Couldn't find pagespec\n";
300 +               return IkiWiki::FailReason->new("Page spec $specName does not exist");
301 +       }
302 +}
303 +
304 +sub match_glob ($$$;@) { #{{{
305         my $page=shift;
306 +       my $specFuncsRef=shift;
307         my $glob=shift;
308         my %params=@_;
309         
310         my $from=exists $params{location} ? $params{location} : '';
311         
312 +       print "Matching glob $glob \n";
313 +       
314         # relative matching
315         if ($glob =~ m!^\./!) {
316                 $from=~s#/?[^/]+$##;
317 @@ -1736,6 +1819,10 @@ sub match_glob ($$;@) { #{{{
318                 $glob="$from/$glob" if length $from;
319         }
320  
321 +       if (substr($glob, 0, 1) eq '~') {
322 +               return check_named_spec($page, $specFuncsRef, $glob);
323 +       }
324 +
325         my $regexp=IkiWiki::glob2re($glob);
326         if ($page=~/^$regexp$/i) {
327                 if (! IkiWiki::isinternal($page) || $params{internal}) {
328 @@ -1750,17 +1837,29 @@ sub match_glob ($$;@) { #{{{
329         }
330  } #}}}
331  
332 -sub match_internal ($$;@) { #{{{
333 -       return match_glob($_[0], $_[1], @_, internal => 1)
334 +sub match_internal ($$$;@) { #{{{
335 +       my $page=shift;
336 +       my $specFuncsRef=shift;
337 +       my $glob=shift;
338 +
339 +       return match_glob($page, $specFuncsRef, $glob, @_, internal => 1)
340  } #}}}
341  
342 -sub match_link ($$;@) { #{{{
343 +sub match_link ($$$;@) { #{{{
344         my $page=shift;
345 -       my $link=lc(shift);
346 +       my $specFuncsRef=shift;
347 +       my $fulllink=shift;
348 +       my $link=lc($fulllink);
349         my %params=@_;
350  
351 +       print "Matching link $fulllink \n";
352 +       
353         my $from=exists $params{location} ? $params{location} : '';
354  
355 +       if (substr($fulllink, 0, 1) eq '~') {
356 +               return check_named_spec_existential($page, $specFuncsRef, $fulllink, \&match_link);
357 +       }
358 +
359         # relative matching
360         if ($link =~ m!^\.! && defined $from) {
361                 $from=~s#/?[^/]+$##;
362 @@ -1784,12 +1883,16 @@ sub match_link ($$;@) { #{{{
363         return IkiWiki::FailReason->new("$page does not link to $link");
364  } #}}}
365  
366 -sub match_backlink ($$;@) { #{{{
367 -       return match_link($_[1], $_[0], @_);
368 +sub match_backlink ($$$;@) { #{{{
369 +       my $page=shift;
370 +       my $specFuncsRef=shift;
371 +       my $backlink=shift;
372 +       return match_link($backlink, $specFuncsRef, $page, @_);
373  } #}}}
374  
375 -sub match_created_before ($$;@) { #{{{
376 +sub match_created_before ($$$;@) { #{{{
377         my $page=shift;
378 +       my $specFuncsRef=shift;
379         my $testpage=shift;
380  
381         if (exists $IkiWiki::pagectime{$testpage}) {
382 @@ -1805,8 +1908,9 @@ sub match_created_before ($$;@) { #{{{
383         }
384  } #}}}
385  
386 -sub match_created_after ($$;@) { #{{{
387 +sub match_created_after ($$$;@) { #{{{
388         my $page=shift;
389 +       my $specFuncsRef=shift;
390         my $testpage=shift;
391  
392         if (exists $IkiWiki::pagectime{$testpage}) {
393 @@ -1822,8 +1926,12 @@ sub match_created_after ($$;@) { #{{{
394         }
395  } #}}}
396  
397 -sub match_creation_day ($$;@) { #{{{
398 -       if ((gmtime($IkiWiki::pagectime{shift()}))[3] == shift) {
399 +sub match_creation_day ($$$;@) { #{{{
400 +       my $page=shift;
401 +       shift;
402 +       my $time=shift;
403 +
404 +       if ((gmtime($IkiWiki::pagectime{$page}))[3] == $time) {
405                 return IkiWiki::SuccessReason->new('creation_day matched');
406         }
407         else {
408 @@ -1831,8 +1939,12 @@ sub match_creation_day ($$;@) { #{{{
409         }
410  } #}}}
411  
412 -sub match_creation_month ($$;@) { #{{{
413 -       if ((gmtime($IkiWiki::pagectime{shift()}))[4] + 1 == shift) {
414 +sub match_creation_month ($$$;@) { #{{{
415 +       my $page=shift;
416 +       shift;
417 +       my $time=shift;
418 +
419 +       if ((gmtime($IkiWiki::pagectime{$page}))[4] + 1 == $time) {
420                 return IkiWiki::SuccessReason->new('creation_month matched');
421         }
422         else {
423 @@ -1840,8 +1952,12 @@ sub match_creation_month ($$;@) { #{{{
424         }
425  } #}}}
426  
427 -sub match_creation_year ($$;@) { #{{{
428 -       if ((gmtime($IkiWiki::pagectime{shift()}))[5] + 1900 == shift) {
429 +sub match_creation_year ($$$;@) { #{{{
430 +       my $page=shift;
431 +       shift;
432 +       my $time=shift;
433 +
434 +       if ((gmtime($IkiWiki::pagectime{$page}))[5] + 1900 == $time) {
435                 return IkiWiki::SuccessReason->new('creation_year matched');
436         }
437         else {
438 diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm
439 index f1f792a..a410e48 100644
440 --- a/IkiWiki/Plugin/attachment.pm
441 +++ b/IkiWiki/Plugin/attachment.pm
442 @@ -291,7 +291,8 @@ sub attachment_list ($) { #{{{
443  
444  package IkiWiki::PageSpec;
445  
446 -sub match_user ($$;@) { #{{{
447 +sub match_user ($$$;@) { #{{{
448 +       shift;
449         shift;
450         my $user=shift;
451         my %params=@_;
452 @@ -311,7 +312,8 @@ sub match_user ($$;@) { #{{{
453         }
454  } #}}}
455  
456 -sub match_ip ($$;@) { #{{{
457 +sub match_ip ($$$;@) { #{{{
458 +       shift;
459         shift;
460         my $ip=shift;
461         my %params=@_;
462 diff --git a/IkiWiki/Plugin/conditional.pm b/IkiWiki/Plugin/conditional.pm
463 index 7716fce..2110ca0 100644
464 --- a/IkiWiki/Plugin/conditional.pm
465 +++ b/IkiWiki/Plugin/conditional.pm
466 @@ -70,7 +70,8 @@ sub preprocess_if (@) { #{{{
467  
468  package IkiWiki::PageSpec;
469  
470 -sub match_enabled ($$;@) { #{{{
471 +sub match_enabled ($$$;@) { #{{{
472 +       shift;
473         shift;
474         my $plugin=shift;
475         
476 @@ -83,13 +84,14 @@ sub match_enabled ($$;@) { #{{{
477         }
478  } #}}}
479  
480 -sub match_sourcepage ($$;@) { #{{{
481 +sub match_sourcepage ($$$;@) { #{{{
482         shift;
483 +       my $specFuncsRef=shift;
484         my $glob=shift;
485         my %params=@_;
486  
487         return IkiWiki::FailReason->new("cannot match sourcepage") unless exists $params{sourcepage};
488 -       if (match_glob($params{sourcepage}, $glob, @_)) {
489 +       if (match_glob($params{sourcepage}, $specFuncsRef, $glob, @_)) {
490                 return IkiWiki::SuccessReason->new("sourcepage matches $glob");
491         }
492         else {
493 @@ -97,13 +99,14 @@ sub match_sourcepage ($$;@) { #{{{
494         }
495  } #}}}
496  
497 -sub match_destpage ($$;@) { #{{{
498 +sub match_destpage ($$$;@) { #{{{
499         shift;
500 +       my $specFuncsRef=shift;
501         my $glob=shift;
502         my %params=@_;
503         
504         return IkiWiki::FailReason->new("cannot match destpage") unless exists $params{destpage};
505 -       if (match_glob($params{destpage}, $glob, @_)) {
506 +       if (match_glob($params{destpage}, $specFuncsRef, $glob, @_)) {
507                 return IkiWiki::SuccessReason->new("destpage matches $glob");
508         }
509         else {
510 @@ -111,7 +114,8 @@ sub match_destpage ($$;@) { #{{{
511         }
512  } #}}}
513  
514 -sub match_included ($$;@) { #{{{
515 +sub match_included ($$$;@) { #{{{
516 +       shift;
517         shift;
518         shift;
519         my %params=@_;
520 diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm
521 index 6f71be3..bf472c5 100644
522 --- a/IkiWiki/Plugin/filecheck.pm
523 +++ b/IkiWiki/Plugin/filecheck.pm
524 @@ -66,8 +66,9 @@ sub humansize ($) { #{{{
525  
526  package IkiWiki::PageSpec;
527  
528 -sub match_maxsize ($$;@) { #{{{
529 +sub match_maxsize ($$$;@) { #{{{
530         my $page=shift;
531 +       shift;
532         my $maxsize=eval{IkiWiki::Plugin::attachment::parsesize(shift)};
533         if ($@) {
534                 return IkiWiki::FailReason->new("unable to parse maxsize (or number too large)");
535 @@ -87,8 +88,9 @@ sub match_maxsize ($$;@) { #{{{
536         }
537  } #}}}
538  
539 -sub match_minsize ($$;@) { #{{{
540 +sub match_minsize ($$$;@) { #{{{
541         my $page=shift;
542 +       shift;
543         my $minsize=eval{IkiWiki::Plugin::attachment::parsesize(shift)};
544         if ($@) {
545                 return IkiWiki::FailReason->new("unable to parse minsize (or number too large)");
546 @@ -108,8 +110,9 @@ sub match_minsize ($$;@) { #{{{
547         }
548  } #}}}
549  
550 -sub match_mimetype ($$;@) { #{{{
551 +sub match_mimetype ($$$;@) { #{{{
552         my $page=shift;
553 +       shift;
554         my $wanted=shift;
555  
556         my %params=@_;
557 @@ -138,8 +141,9 @@ sub match_mimetype ($$;@) { #{{{
558         }
559  } #}}}
560  
561 -sub match_virusfree ($$;@) { #{{{
562 +sub match_virusfree ($$$;@) { #{{{
563         my $page=shift;
564 +       shift;
565         my $wanted=shift;
566  
567         my %params=@_;
568 @@ -180,7 +184,7 @@ sub match_virusfree ($$;@) { #{{{
569         }
570  } #}}}
571  
572 -sub match_ispage ($$;@) { #{{{
573 +sub match_ispage ($$$;@) { #{{{
574         my $filename=shift;
575  
576         if (defined IkiWiki::pagetype($filename)) {
577 diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
578 index b2c85c8..1ee6a69 100644
579 --- a/IkiWiki/Plugin/meta.pm
580 +++ b/IkiWiki/Plugin/meta.pm
581 @@ -264,6 +264,7 @@ sub pagetemplate (@) { #{{{
582  sub match { #{{{
583         my $field=shift;
584         my $page=shift;
585 +       shift;
586         
587         # turn glob into a safe regexp
588         my $re=IkiWiki::glob2re(shift);
589 @@ -291,23 +292,23 @@ sub match { #{{{
590  
591  package IkiWiki::PageSpec;
592  
593 -sub match_title ($$;@) { #{{{
594 +sub match_title ($$$;@) { #{{{
595         IkiWiki::Plugin::meta::match("title", @_);      
596  } #}}}
597  
598 -sub match_author ($$;@) { #{{{
599 +sub match_author ($$$;@) { #{{{
600         IkiWiki::Plugin::meta::match("author", @_);
601  } #}}}
602  
603 -sub match_authorurl ($$;@) { #{{{
604 +sub match_authorurl ($$$;@) { #{{{
605         IkiWiki::Plugin::meta::match("authorurl", @_);
606  } #}}}
607  
608 -sub match_license ($$;@) { #{{{
609 +sub match_license ($$$;@) { #{{{
610         IkiWiki::Plugin::meta::match("license", @_);
611  } #}}}
612  
613 -sub match_copyright ($$;@) { #{{{
614 +sub match_copyright ($$$;@) { #{{{
615         IkiWiki::Plugin::meta::match("copyright", @_);
616  } #}}}
617