]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* pagespec_match() has changed to take named parameters, to better allow
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 27 Apr 2007 02:55:52 +0000 (02:55 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 27 Apr 2007 02:55:52 +0000 (02:55 +0000)
  for extended pagespecs. The old calling convention will still work for
  back-compat for now.
* The calling convention for functions in the IkiWiki::PageSpec namespace
  has changed so they are passed named parameters.
* Plugin interface version increased to 2.00 since I don't anticipate any
  more interface changes before 2.0.

60 files changed:
IkiWiki.pm
IkiWiki/Plugin/aggregate.pm
IkiWiki/Plugin/anonok.pm
IkiWiki/Plugin/brokenlinks.pm
IkiWiki/Plugin/camelcase.pm
IkiWiki/Plugin/conditional.pm
IkiWiki/Plugin/ddate.pm
IkiWiki/Plugin/favicon.pm
IkiWiki/Plugin/fortune.pm
IkiWiki/Plugin/goodstuff.pm
IkiWiki/Plugin/googlecalendar.pm
IkiWiki/Plugin/graphviz.pm
IkiWiki/Plugin/haiku.pm
IkiWiki/Plugin/html.pm
IkiWiki/Plugin/htmlscrubber.pm
IkiWiki/Plugin/htmltidy.pm
IkiWiki/Plugin/httpauth.pm
IkiWiki/Plugin/img.pm
IkiWiki/Plugin/inline.pm
IkiWiki/Plugin/linkmap.pm
IkiWiki/Plugin/lockedit.pm
IkiWiki/Plugin/map.pm
IkiWiki/Plugin/mdwn.pm
IkiWiki/Plugin/meta.pm
IkiWiki/Plugin/mirrorlist.pm
IkiWiki/Plugin/more.pm
IkiWiki/Plugin/opendiscussion.pm
IkiWiki/Plugin/openid.pm
IkiWiki/Plugin/orphans.pm
IkiWiki/Plugin/otl.pm
IkiWiki/Plugin/pagecount.pm
IkiWiki/Plugin/pagestats.pm
IkiWiki/Plugin/passwordauth.pm
IkiWiki/Plugin/poll.pm
IkiWiki/Plugin/polygen.pm
IkiWiki/Plugin/postsparkline.pm
IkiWiki/Plugin/prettydate.pm
IkiWiki/Plugin/rawhtml.pm
IkiWiki/Plugin/rst.pm
IkiWiki/Plugin/search.pm
IkiWiki/Plugin/shortcut.pm
IkiWiki/Plugin/sidebar.pm
IkiWiki/Plugin/signinedit.pm
IkiWiki/Plugin/skeleton.pm
IkiWiki/Plugin/smiley.pm
IkiWiki/Plugin/sparkline.pm
IkiWiki/Plugin/table.pm
IkiWiki/Plugin/tag.pm
IkiWiki/Plugin/template.pm
IkiWiki/Plugin/textile.pm
IkiWiki/Plugin/toc.pm
IkiWiki/Plugin/toggle.pm
IkiWiki/Plugin/typography.pm
IkiWiki/Plugin/wikitext.pm
IkiWiki/Render.pm
IkiWiki/UserInfo.pm
debian/changelog
doc/plugins/write.mdwn
po/ikiwiki.pot
t/pagespec_match.t

index 5f0055d3ed787d08f5436fff1bbee0fcb8d86a3c..7c910a53dfe62b6a88c5c7c85714318739c91663 100644 (file)
@@ -18,7 +18,7 @@ our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match
                  bestlink htmllink readfile writefile pagetype srcfile pagename
                  displaytime will_render gettext urlto targetpage
                  %config %links %renderedfiles %pagesources %destsources);
                  bestlink htmllink readfile writefile pagetype srcfile pagename
                  displaytime will_render gettext urlto targetpage
                  %config %links %renderedfiles %pagesources %destsources);
-our $VERSION = 1.02; # plugin interface version, next is ikiwiki version
+our $VERSION = 2.00; # plugin interface version, next is ikiwiki version
 our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
 my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
 
 our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
 my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
 
@@ -974,38 +974,42 @@ sub pagespec_translate ($) { #{{{
                }
                elsif ($word =~ /^(\w+)\((.*)\)$/) {
                        if (exists $IkiWiki::PageSpec::{"match_$1"}) {
                }
                elsif ($word =~ /^(\w+)\((.*)\)$/) {
                        if (exists $IkiWiki::PageSpec::{"match_$1"}) {
-                               $code.="IkiWiki::PageSpec::match_$1(\$page, ".safequote($2).", \$from)";
+                               $code.="IkiWiki::PageSpec::match_$1(\$page, ".safequote($2).", \@params)";
                        }
                        else {
                                $code.=" 0";
                        }
                }
                else {
                        }
                        else {
                                $code.=" 0";
                        }
                }
                else {
-                       $code.=" IkiWiki::PageSpec::match_glob(\$page, ".safequote($word).", \$from)";
+                       $code.=" IkiWiki::PageSpec::match_glob(\$page, ".safequote($word).", \@params)";
                }
        }
 
        return $code;
 } #}}}
 
                }
        }
 
        return $code;
 } #}}}
 
-sub pagespec_match ($$;$) { #{{{
+sub pagespec_match ($$;@) { #{{{
        my $page=shift;
        my $spec=shift;
        my $page=shift;
        my $spec=shift;
-       my $from=shift;
+       my @params=@_;
+
+       # Backwards compatability with old calling convention.
+       if (@params == 1) {
+               unshift @params, "location";
+       }
 
        return eval pagespec_translate($spec);
 } #}}}
 
 package IkiWiki::PageSpec;
 
 
        return eval pagespec_translate($spec);
 } #}}}
 
 package IkiWiki::PageSpec;
 
-sub match_glob ($$$) { #{{{
+sub match_glob ($$;@) { #{{{
        my $page=shift;
        my $glob=shift;
        my $page=shift;
        my $glob=shift;
-       my $from=shift;
-       if (! defined $from){
-               $from = "";
-       }
-
+       my %params=@_;
+       
+       my $from=exists $params{location} ? $params{location} : "";
+       
        # relative matching
        if ($glob =~ m!^\./!) {
                $from=~s!/?[^/]+$!!;
        # relative matching
        if ($glob =~ m!^\./!) {
                $from=~s!/?[^/]+$!!;
@@ -1021,13 +1025,12 @@ sub match_glob ($$$) { #{{{
        return $page=~/^$glob$/i;
 } #}}}
 
        return $page=~/^$glob$/i;
 } #}}}
 
-sub match_link ($$$) { #{{{
+sub match_link ($$;@) { #{{{
        my $page=shift;
        my $link=lc(shift);
        my $page=shift;
        my $link=lc(shift);
-       my $from=shift;
-       if (! defined $from){
-               $from = "";
-       }
+       my %params=@_;
+
+       my $from=exists $params{location} ? $params{location} : "";
 
        # relative matching
        if ($link =~ m!^\.! && defined $from) {
 
        # relative matching
        if ($link =~ m!^\.! && defined $from) {
@@ -1046,11 +1049,11 @@ sub match_link ($$$) { #{{{
        return 0;
 } #}}}
 
        return 0;
 } #}}}
 
-sub match_backlink ($$$) { #{{{
-       match_link($_[1], $_[0], $_[3]);
+sub match_backlink ($$;@) { #{{{
+       match_link($_[1], $_[0], @_);
 } #}}}
 
 } #}}}
 
-sub match_created_before ($$$) { #{{{
+sub match_created_before ($$;@) { #{{{
        my $page=shift;
        my $testpage=shift;
 
        my $page=shift;
        my $testpage=shift;
 
@@ -1062,7 +1065,7 @@ sub match_created_before ($$$) { #{{{
        }
 } #}}}
 
        }
 } #}}}
 
-sub match_created_after ($$$) { #{{{
+sub match_created_after ($$;@) { #{{{
        my $page=shift;
        my $testpage=shift;
 
        my $page=shift;
        my $testpage=shift;
 
@@ -1074,16 +1077,25 @@ sub match_created_after ($$$) { #{{{
        }
 } #}}}
 
        }
 } #}}}
 
-sub match_creation_day ($$$) { #{{{
+sub match_creation_day ($$;@) { #{{{
        return ((gmtime($IkiWiki::pagectime{shift()}))[3] == shift);
 } #}}}
 
        return ((gmtime($IkiWiki::pagectime{shift()}))[3] == shift);
 } #}}}
 
-sub match_creation_month ($$$) { #{{{
+sub match_creation_month ($$;@) { #{{{
        return ((gmtime($IkiWiki::pagectime{shift()}))[4] + 1 == shift);
 } #}}}
 
        return ((gmtime($IkiWiki::pagectime{shift()}))[4] + 1 == shift);
 } #}}}
 
-sub match_creation_year ($$$) { #{{{
+sub match_creation_year ($$;@) { #{{{
        return ((gmtime($IkiWiki::pagectime{shift()}))[5] + 1900 == shift);
 } #}}}
 
        return ((gmtime($IkiWiki::pagectime{shift()}))[5] + 1900 == shift);
 } #}}}
 
+sub match_user ($$;@) { #{{{
+       shift;
+       my $user=shift;
+       my %params=@_;
+
+       return unless exists $params{user};
+       return $user eq $params{user};
+} #}}}
+
 1
 1
index 319243727e4547222373ea6ddcae998a1fd60274..78f8b409c1fb01960ba1b66c03989fafd346e08c 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::aggregate;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use HTML::Entities;
 use HTML::Parser;
 use HTML::Tagset;
 use HTML::Entities;
 use HTML::Parser;
 use HTML::Tagset;
index 3e2a746e634b8dd2670ff291af0e19a53522e525..cd05cd865f9029e76aa571d35b47c30a2d51de1b 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::anonok;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "canedit", id => "anonok", call => \&canedit,);
 
 sub import { #{{{
        hook(type => "canedit", id => "anonok", call => \&canedit,);
index d9d50f75f48be54b7267c3a541cf39c830478b85..fa34a70089d2fe2ffa651a5a6b001f22cf5141cd 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::brokenlinks;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "preprocess", id => "brokenlinks", call => \&preprocess);
 
 sub import { #{{{
        hook(type => "preprocess", id => "brokenlinks", call => \&preprocess);
@@ -20,7 +20,7 @@ sub preprocess (@) { #{{{
        
        my @broken;
        foreach my $page (keys %links) {
        
        my @broken;
        foreach my $page (keys %links) {
-               if (pagespec_match($page, $params{pages}, $params{page})) {
+               if (pagespec_match($page, $params{pages}, location => $params{page})) {
                        my $discussion=gettext("discussion");
                        foreach my $link (@{$links{$page}}) {
                                next if $link =~ /.*\/\Q$discussion\E/i && $config{discussion};
                        my $discussion=gettext("discussion");
                        foreach my $link (@{$links{$page}}) {
                                next if $link =~ /.*\/\Q$discussion\E/i && $config{discussion};
index 0bb35b6e26249294fb7d3aa57c38b17a59663e69..29d22b0dd3826ee1c4651af6447fa39970097648 100644 (file)
@@ -2,9 +2,9 @@
 # CamelCase links
 package IkiWiki::Plugin::camelcase;
 
 # CamelCase links
 package IkiWiki::Plugin::camelcase;
 
-use IkiWiki;
 use warnings;
 use strict;
 use warnings;
 use strict;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "filter", id => "camelcase", call => \&filter);
 
 sub import { #{{{
        hook(type => "filter", id => "camelcase", call => \&filter);
index 22057c1359f6cf90800d0f60130024167ded1567..29223ace24ef419bfb23bdd468a061bdebfdac19 100644 (file)
@@ -3,12 +3,9 @@ package IkiWiki::Plugin::conditional;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use UNIVERSAL;
 
 use UNIVERSAL;
 
-# Globals used to pass information into the PageSpec functions.
-our ($sourcepage, $destpage);
-
 sub import { #{{{
        hook(type => "preprocess", id => "if", call => \&preprocess_if);
 } # }}}
 sub import { #{{{
        hook(type => "preprocess", id => "if", call => \&preprocess_if);
 } # }}}
@@ -21,27 +18,28 @@ sub preprocess_if (@) { #{{{
        }
 
        my $result=0;
        }
 
        my $result=0;
-       $sourcepage=$params{page};
-       $destpage=$params{destpage};
        # An optimisation to avoid needless looping over every page
        # and adding of dependencies for simple uses of some of the
        # tests.
        if ($params{test} =~ /^(enabled|sourcepage|destpage)\((.*)\)$/) {
        # An optimisation to avoid needless looping over every page
        # and adding of dependencies for simple uses of some of the
        # tests.
        if ($params{test} =~ /^(enabled|sourcepage|destpage)\((.*)\)$/) {
-               $result=eval "IkiWiki::PageSpec::match_$1(undef, ".
-                       IkiWiki::safequote($2).", \$params{page})";
+               $result=pagespec_match($params{page}, $params{test},
+                               location => $params{page},
+                               sourcepage => $params{page},
+                               destpage => $params{destpage});
        }
        else {
                add_depends($params{page}, $params{test});
 
                foreach my $page (keys %pagesources) {
        }
        else {
                add_depends($params{page}, $params{test});
 
                foreach my $page (keys %pagesources) {
-                       if (pagespec_match($page, $params{test}, $params{page})) {
+                       if (pagespec_match($page, $params{test}, 
+                                       location => $params{page},
+                                       sourcepage => $params{page},
+                                       destpage => $params{destpage})) {
                                $result=1;
                                last;
                        }
                }
        }
                                $result=1;
                                last;
                        }
                }
        }
-       $sourcepage="";
-       $destpage="";
 
        my $ret;
        if ($result) {
 
        my $ret;
        if ($result) {
@@ -59,7 +57,7 @@ sub preprocess_if (@) { #{{{
 
 package IkiWiki::PageSpec;
 
 
 package IkiWiki::PageSpec;
 
-sub match_enabled ($$$) { #{{{
+sub match_enabled ($$;@) { #{{{
        shift;
        my $plugin=shift;
        
        shift;
        my $plugin=shift;
        
@@ -67,24 +65,31 @@ sub match_enabled ($$$) { #{{{
        return UNIVERSAL::can("IkiWiki::Plugin::".$plugin, "import");
 } #}}}
 
        return UNIVERSAL::can("IkiWiki::Plugin::".$plugin, "import");
 } #}}}
 
-sub match_sourcepage ($$$) { #{{{
+sub match_sourcepage ($$;@) { #{{{
        shift;
        my $glob=shift;
        shift;
        my $glob=shift;
-       
-       return match_glob($IkiWiki::Plugin::conditional::sourcepage, $glob,
-               $IkiWiki::Plugin::conditional::sourcepage);
+       my %params=@_;
+
+       return unless exists $params{sourcepage};
+       return match_glob($params{sourcepage}, $glob, @_);
 } #}}}
 
 } #}}}
 
-sub match_destpage ($$$) { #{{{
+sub match_destpage ($$;@) { #{{{
        shift;
        my $glob=shift;
        shift;
        my $glob=shift;
+       my %params=@_;
        
        
-       return match_glob($IkiWiki::Plugin::conditional::destpage, $glob,
-               $IkiWiki::Plugin::conditional::sourcepage);
+       return unless exists $params{destpage};
+       return match_glob($params{destpage}, $glob, @_);
 } #}}}
 
 } #}}}
 
-sub match_included ($$$) { #{{{
-       return $IkiWiki::Plugin::conditional::sourcepage ne $IkiWiki::Plugin::conditional::destpage;
+sub match_included ($$;$) { #{{{
+       shift;
+       shift;
+       my %params=@_;
+
+       return unless exists $params{sourcepage} && exists $params{destpage};
+       return $params{sourcepage} ne $params{destpage};
 } #}}}
 
 1
 } #}}}
 
 1
index 862d4da5b180146356757dff5600977a2df41966..f4921fdfd70bc04ccf87bc0b5650c80d13d9c6f6 100644 (file)
@@ -1,7 +1,8 @@
 #!/usr/bin/perl
 # Discordian date support fnord ikiwiki.
 package IkiWiki::Plugin::ddate;
 #!/usr/bin/perl
 # Discordian date support fnord ikiwiki.
 package IkiWiki::Plugin::ddate;
-use IkiWiki;
+
+use IkiWiki 2.00;
 no warnings;
 
 sub import { #{{{
 no warnings;
 
 sub import { #{{{
index 864131d1e128ce5d1b84776a945d1ba9c6f89a1f..7169c58c342f9ef97defe60a1004aebab8f98555 100644 (file)
@@ -5,7 +5,7 @@ package IkiWiki::Plugin::favicon;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "pagetemplate", id => "favicon", call => \&pagetemplate);
 
 sub import { #{{{
        hook(type => "pagetemplate", id => "favicon", call => \&pagetemplate);
index 3bab134bed8e8d4bf152dee04bbff1bdb42a9727..a3b13f687dac48aa37eee64ddf2eb7035dbac064 100644 (file)
@@ -2,9 +2,9 @@
 # Include a fortune in a page
 package IkiWiki::Plugin::fortune;
 
 # Include a fortune in a page
 package IkiWiki::Plugin::fortune;
 
-use IkiWiki;
 use warnings;
 use strict;
 use warnings;
 use strict;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "preprocess", id => "fortune", call => \&preprocess);
 
 sub import { #{{{
        hook(type => "preprocess", id => "fortune", call => \&preprocess);
index 384123f601b380597bb4dba3c912ecebef6f103f..effbc7de9ff14759409ba36bf9b18d8230fe2123 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::goodstuff;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 my @bundle=qw{
        brokenlinks
 
 my @bundle=qw{
        brokenlinks
index 3f5102210f0e30ae73ba3a322b7ab98345c69084..c6409e5e6db3732e1efd3ea4d5232b5dc66c76be 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::googlecalendar;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "preprocess", id => "googlecalendar",
 
 sub import { #{{{
        hook(type => "preprocess", id => "googlecalendar",
index 48f520c4f92f9fc7279852d017310d20ed061a25..5d666e1be68d854e8c4e00f96c627de699521859 100644 (file)
@@ -5,7 +5,7 @@ package IkiWiki::Plugin::graphviz;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use IPC::Open2;
 
 sub import { #{{{
 use IPC::Open2;
 
 sub import { #{{{
index fe8a782fad2ffdf5c83c4ecb0c86f269195dd2d7..35208e56cfcc307ba95f23555ec537d1b78859e7 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::haiku;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "preprocess", id => "haiku", call => \&preprocess);
 
 sub import { #{{{
        hook(type => "preprocess", id => "haiku", call => \&preprocess);
index fd40d5ad97910b72f5d81ceded2a287efd44f96d..7623ba6a96accd71d67d8a7ac84c1422ed535224 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::html;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "htmlize", id => "html", call => \&htmlize);
 
 sub import { #{{{
        hook(type => "htmlize", id => "html", call => \&htmlize);
index ae3ec44569d3e666ca5abe60f9afc19e5b6643c6..c5b08f60435b8b37ffb0b75732cfe92a8a6980ad 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::htmlscrubber;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "sanitize", id => "htmlscrubber", call => \&sanitize);
 
 sub import { #{{{
        hook(type => "sanitize", id => "htmlscrubber", call => \&sanitize);
index 0609e72c328e5ea4fc06b945203f51f73e0e6338..cd5dc83acc6b1da5b990f18105070f1fba132487 100644 (file)
@@ -9,7 +9,7 @@ package IkiWiki::Plugin::htmltidy;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use IPC::Open2;
 
 sub import { #{{{
 use IPC::Open2;
 
 sub import { #{{{
index 786bcba3b34b99676766f074f52db9bb6beda264..d28b6d2d0f033dcd107ceb7b9632b991c8da73a9 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::httpauth;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "auth", id => "httpauth", call => \&auth);
 
 sub import { #{{{
        hook(type => "auth", id => "httpauth", call => \&auth);
index 8888b3a56d8bb2a350fe22a310cf8cb23c390c6a..7226231a05bd74f01aeeebed3293e60ada885e28 100644 (file)
@@ -5,7 +5,7 @@ package IkiWiki::Plugin::img;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 my %imgdefaults;
 
 
 my %imgdefaults;
 
index 417eec8f3c93721af1dbecc8504de400bb8039c7..3c029e001f78a208840b26aa814df1a742a7b5ca 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::inline;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki 1.00;
+use IkiWiki 2.00;
 use URI;
 
 sub import { #{{{
 use URI;
 
 sub import { #{{{
@@ -88,7 +88,7 @@ sub preprocess_inline (@) { #{{{
        my @list;
        foreach my $page (keys %pagesources) {
                next if $page eq $params{page};
        my @list;
        foreach my $page (keys %pagesources) {
                next if $page eq $params{page};
-               if (pagespec_match($page, $params{pages}, $params{page})) {
+               if (pagespec_match($page, $params{pages}, location => $params{page})) {
                        push @list, $page;
                }
        }
                        push @list, $page;
                }
        }
@@ -223,7 +223,7 @@ sub preprocess_inline (@) { #{{{
                        @list=@list[0..$params{feedshow} - 1];
                }
                if (exists $params{feedpages}) {
                        @list=@list[0..$params{feedshow} - 1];
                }
                if (exists $params{feedpages}) {
-                       @list=grep { pagespec_match($_, $params{feedpages}, $params{page}) } @list;
+                       @list=grep { pagespec_match($_, $params{feedpages}, location => $params{page}) } @list;
                }
        
                if ($rss) {
                }
        
                if ($rss) {
index 29a3339a6a955c7e1790d12b8723d0620d4c6cb1..62984d9b88b1082c8d40cca133ed8ae5174fb26f 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::linkmap;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use IPC::Open2;
 
 sub import { #{{{
 use IPC::Open2;
 
 sub import { #{{{
@@ -48,7 +48,7 @@ sub genmap ($) { #{{{
        # Get all the items to map.
        my %mapitems = ();
        foreach my $item (keys %links) {
        # Get all the items to map.
        my %mapitems = ();
        foreach my $item (keys %links) {
-               if (pagespec_match($item, $params{pages}, $params{page})) {
+               if (pagespec_match($item, $params{pages}, location => $params{page})) {
                        $mapitems{$item}=urlto($item, $params{destpage});
                }
        }
                        $mapitems{$item}=urlto($item, $params{destpage});
                }
        }
index f204e72c0052df303469c5970a4046c6ba96bd7f..13df5632fb1d36f50c2fd6050d1f38069c3405db 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::lockedit;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "canedit", id => "lockedit", call => \&canedit);
 
 sub import { #{{{
        hook(type => "canedit", id => "lockedit", call => \&canedit);
@@ -20,7 +20,7 @@ sub canedit ($$) { #{{{
        return undef if defined $user && IkiWiki::is_admin($user);
 
        foreach my $admin (@{$config{adminuser}}) {
        return undef if defined $user && IkiWiki::is_admin($user);
 
        foreach my $admin (@{$config{adminuser}}) {
-               if (pagespec_match($page, IkiWiki::userinfo_get($admin, "locked_pages"), "")) {
+               if (pagespec_match($page, IkiWiki::userinfo_get($admin, "locked_pages"))) {
                        return sprintf(gettext("%s is locked by %s and cannot be edited"),
                                htmllink("", "", $page, noimageinline => 1),
                                IkiWiki::userlink($admin));
                        return sprintf(gettext("%s is locked by %s and cannot be edited"),
                                htmllink("", "", $page, noimageinline => 1),
                                IkiWiki::userlink($admin));
index 07b63cb708d9759da62ea9e5e8df9701ebd0322a..5aa2852de0926e8dd1bd50fe36f6699a5bc1a60d 100644 (file)
@@ -9,7 +9,7 @@ package IkiWiki::Plugin::map;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "preprocess", id => "map", call => \&preprocess);
 
 sub import { #{{{
        hook(type => "preprocess", id => "map", call => \&preprocess);
@@ -26,7 +26,7 @@ sub preprocess (@) { #{{{
        # Get all the items to map.
        my @mapitems = ();
        foreach my $page (keys %links) {
        # Get all the items to map.
        my @mapitems = ();
        foreach my $page (keys %links) {
-               if (pagespec_match($page, $params{pages}, $params{page})) {
+               if (pagespec_match($page, $params{pages}, location => $params{page})) {
                        push @mapitems, $page;
                }
        }
                        push @mapitems, $page;
                }
        }
index c087f2b41309f892e52476305bf31ccc48fb7840..ca8898679216684da988bfd2fb08cd14dd04ff51 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::mdwn;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "htmlize", id => "mdwn", call => \&htmlize);
 
 sub import { #{{{
        hook(type => "htmlize", id => "mdwn", call => \&htmlize);
index e13f57978b5e3895a4266c0f66d93472f23df6e7..18e28a196a47805f6d95550894dc62e917d60593 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::meta;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 my %meta;
 my %title;
 
 my %meta;
 my %title;
index 34a97cc0bc02b655e9cd5f8c045fd95ca4eab4fe..3997e6fefcd31c15a8fa6df7e559a6ffdf84e863 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::mirrorlist;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "pagetemplate", id => "mirrorlist", call => \&pagetemplate);
 
 sub import { #{{{
        hook(type => "pagetemplate", id => "mirrorlist", call => \&pagetemplate);
index dae3728ba37118dcdc717cafa6e36dd591410231..6a34682ba61c9043ffff65343acd035e018cce25 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::more;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 my $linktext = gettext("more");
 
 
 my $linktext = gettext("more");
 
index 4b1a432b21d32c3948fd7bf623a7cfe79f04dff6..fd5c9673d68c3581722dbe41502d0363d502a5ac 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::opendiscussion;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "canedit", id => "opendiscussion", call => \&canedit);
 
 sub import { #{{{
        hook(type => "canedit", id => "opendiscussion", call => \&canedit);
index 65b884814e9795af6f615e514868585704d9f328..34cd157f52069169d63bec134c5bf9d2a5c35c59 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::openid;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "getopt", id => "openid", call => \&getopt);
 
 sub import { #{{{
        hook(type => "getopt", id => "openid", call => \&getopt);
index 65d5e3e9ba503327bbd8e1404a7080b2c85aa1b4..3a0150d53e4c52b08fe076bf276c1bb2e6e563dd 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::orphans;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "preprocess", id => "orphans", call => \&preprocess);
 
 sub import { #{{{
        hook(type => "preprocess", id => "orphans", call => \&preprocess);
@@ -28,7 +28,7 @@ sub preprocess (@) { #{{{
        my $discussion=gettext("discussion");
        foreach my $page (keys %pagesources) {
                next if $linkedto{$page};
        my $discussion=gettext("discussion");
        foreach my $page (keys %pagesources) {
                next if $linkedto{$page};
-               next unless pagespec_match($page, $params{pages}, $params{page});
+               next unless pagespec_match($page, $params{pages}, location => $params{page});
                # If the page has a link to some other page, it's
                # indirectly linked to a page via that page's backlinks.
                next if grep { 
                # If the page has a link to some other page, it's
                # indirectly linked to a page via that page's backlinks.
                next if grep { 
index 94a2b80f6ef16048b6c5ff87e168255dd746145e..20291d7e535aecb1e6d1fe36a7ed713aec7edf84 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::otl;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "filter", id => "otl", call => \&filter);
 
 sub import { #{{{
        hook(type => "filter", id => "otl", call => \&filter);
index 313ffdff0d6e9c225957d692fbfdea6a9f3109a3..2c20ca195dcd1f55ff4cdbe9ad70fed642c236af 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::pagecount;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "preprocess", id => "pagecount", call => \&preprocess);
 
 sub import { #{{{
        hook(type => "preprocess", id => "pagecount", call => \&preprocess);
@@ -21,7 +21,7 @@ sub preprocess (@) { #{{{
        return $#pages+1 if $params{pages} eq "*"; # optimisation
        my $count=0;
        foreach my $page (@pages) {
        return $#pages+1 if $params{pages} eq "*"; # optimisation
        my $count=0;
        foreach my $page (@pages) {
-               $count++ if pagespec_match($page, $params{pages}, $params{page});
+               $count++ if pagespec_match($page, $params{pages}, location => $params{page});
        }
        return $count;
 } # }}}
        }
        return $count;
 } # }}}
index 1edb3945520fbbd9c3473d3b153034d01de70255..f6398c535f29ce2768e7389bf4d8b7581407d61a 100644 (file)
@@ -12,7 +12,7 @@ package IkiWiki::Plugin::pagestats;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 # Names of the HTML classes to use for the tag cloud
 our @classes = ('smallestPC', 'smallPC', 'normalPC', 'bigPC', 'biggestPC' );
 
 # Names of the HTML classes to use for the tag cloud
 our @classes = ('smallestPC', 'smallPC', 'normalPC', 'bigPC', 'biggestPC' );
@@ -33,7 +33,7 @@ sub preprocess (@) { #{{{
        my %counts;
        my $max = 0;
        foreach my $page (keys %links) {
        my %counts;
        my $max = 0;
        foreach my $page (keys %links) {
-               if (pagespec_match($page, $params{pages}, $params{page})) {
+               if (pagespec_match($page, $params{pages}, location => $params{page})) {
                        use IkiWiki::Render;
                        my @bl = IkiWiki::backlinks($page);
                        $counts{$page} = scalar(@bl);
                        use IkiWiki::Render;
                        my @bl = IkiWiki::backlinks($page);
                        $counts{$page} = scalar(@bl);
index e0aa72a196152e3c38d2d6bf74fbe64fc75854e7..131b3a43e16f2d935067a10dbe3a7aa8b76ea09e 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::passwordauth;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
         hook(type => "formbuilder_setup", id => "passwordauth",
 
 sub import { #{{{
         hook(type => "formbuilder_setup", id => "passwordauth",
index 86ed4c840d6757226821411b34d8fffa0d78926e..63c93c62d9380fedbfa2954ee24ea9eac7f9c76d 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::poll;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "preprocess", id => "poll", call => \&preprocess);
 
 sub import { #{{{
        hook(type => "preprocess", id => "poll", call => \&preprocess);
index 63f6bf5db59b7ad94987ca620fcda7ae837e973d..5208a44ec5c9a342ff798a3ec8401f240f8562ba 100644 (file)
@@ -7,7 +7,7 @@ package IkiWiki::Plugin::polygen;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use File::Find;
 
 sub import { #{{{
 use File::Find;
 
 sub import { #{{{
index 2bc93088d960a527cef001a7912398b533c1e048..e4fe9c154d0fa95420243c0f4bf8c65ab2187322 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::postsparkline;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        IkiWiki::loadplugin('sparkline');
 
 sub import { #{{{
        IkiWiki::loadplugin('sparkline');
@@ -37,7 +37,7 @@ sub preprocess (@) { #{{{
        my @list;
        foreach my $page (keys %pagesources) {
                next if $page eq $params{page};
        my @list;
        foreach my $page (keys %pagesources) {
                next if $page eq $params{page};
-               if (pagespec_match($page, $params{pages}, $params{page})) {
+               if (pagespec_match($page, $params{pages}, location => $params{page})) {
                        push @list, $page;
                }
        }
                        push @list, $page;
                }
        }
index 11bd69d3f58bd2c06435af6a1de6bd25a377ea5b..44ffb719e3b8aeb515b814784e52223b71c3f684 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 package IkiWiki::Plugin::prettydate;
 #!/usr/bin/perl
 package IkiWiki::Plugin::prettydate;
-use IkiWiki;
+use IkiWiki 2.00;
 use warnings;
 no warnings 'redefine';
 use strict;
 use warnings;
 no warnings 'redefine';
 use strict;
index 30e9715141f4812a1227e729060d554f505e2c85..011c3a862c678d0cae73a3df3f669dec6b8d1917 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::rawhtml;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        $config{wiki_file_prune_regexps} = [ grep { !m/\\\.x\?html\?\$/ } @{$config{wiki_file_prune_regexps}} ];
 
 sub import { #{{{
        $config{wiki_file_prune_regexps} = [ grep { !m/\\\.x\?html\?\$/ } @{$config{wiki_file_prune_regexps}} ];
index afd60f6687d5e759321cb42261fb1a48a3241094..1f4c8bf9e9c0adf6081d9a67fd04c23a32b3975d 100644 (file)
@@ -18,7 +18,7 @@ package IkiWiki::Plugin::rst;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use IPC::Open2;
 
 # Simple python script, maybe it should be implemented using an external script.
 use IPC::Open2;
 
 # Simple python script, maybe it should be implemented using an external script.
index 61e9214e62a70dff8f86f58dfd26e2b2ffe0306f..da818e5cfea6c2f87719d78648dfa32d779491d0 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::search;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "getopt", id => "hyperestraier",
 
 sub import { #{{{
        hook(type => "getopt", id => "hyperestraier",
index 7b89bf879cdf48be4421a205399cb27a07a489f8..28d0c71771e7d407967b4bea649fe301a08306b5 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::shortcut;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "checkconfig", id => "shortcut", call => \&checkconfig);
 
 sub import { #{{{
        hook(type => "checkconfig", id => "shortcut", call => \&checkconfig);
index da1f82b82ba87365c902337718d1b29ecc7ffde9..f0dd0ca0352ce1077141079bd349906572f00bea 100644 (file)
@@ -6,7 +6,7 @@ package IkiWiki::Plugin::sidebar;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "pagetemplate", id => "sidebar", call => \&pagetemplate);
 
 sub import { #{{{
        hook(type => "pagetemplate", id => "sidebar", call => \&pagetemplate);
index 04532f4dce6151a2d5645ce5adce91debace50f7..08932e2f6bb69a13f064ea8a17796a241862a5f8 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::signinedit;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "canedit", id => "signinedit", call => \&canedit,
 
 sub import { #{{{
        hook(type => "canedit", id => "signinedit", call => \&canedit,
index 8b51b155081c20a943f2b0dc2ffb8db29441be95..b8c327c9d9a3281acd587ec812a8b44154384fdb 100644 (file)
@@ -6,7 +6,7 @@ package IkiWiki::Plugin::skeleton;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki '1.02';
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "getopt", id => "skeleton",  call => \&getopt);
 
 sub import { #{{{
        hook(type => "getopt", id => "skeleton",  call => \&getopt);
index e85abbb85ec4f3bb44f9ac23bda4683dc8d1070e..1a9833e6eed899ae2ed3a77d337f2e06ea789c29 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::smiley;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 my %smileys;
 my $smiley_regexp;
 
 my %smileys;
 my $smiley_regexp;
index 06036867970eb5656a3b23cc44ef4683b95e221f..69b3512c27e708d1155fab842e76b46b7dbff9f5 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::sparkline;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use IPC::Open2;
 
 my $match_num=qr/[-+]?[0-9]+(?:\.[0-9]+)?/;
 use IPC::Open2;
 
 my $match_num=qr/[-+]?[0-9]+(?:\.[0-9]+)?/;
index 2ed60ab4604b3193b15914c6732568012c3a328d..698f9c9b61501034736e82d2c1deac3167670072 100644 (file)
@@ -3,8 +3,7 @@ package IkiWiki::Plugin::table;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "preprocess", id => "table", call => \&preprocess);
 
 sub import { #{{{
        hook(type => "preprocess", id => "table", call => \&preprocess);
index 733d76f4eb16bf888c680f6456f9a8711fd42fab..48ed1a8f87eb67ae74302484d49942a468a7a7f4 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::tag;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 my %tags;
 
 
 my %tags;
 
index 690443558e71788e616f13575008cdfbffc09c3d..b169f7e75f23c1528c44ecbad00eb661d3df4d73 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::template;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use HTML::Template;
 use Encode;
 
 use HTML::Template;
 use Encode;
 
index ee8e88ed206bd6cabda1f7fb4c9d46cec84aa48b..5de71bf6eb11aa682dde75eaac98970b4174c9f9 100644 (file)
@@ -6,7 +6,7 @@ package IkiWiki::Plugin::textile;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "htmlize", id => "txtl", call => \&htmlize);
 
 sub import { #{{{
        hook(type => "htmlize", id => "txtl", call => \&htmlize);
index 279eef00837a66c901056096c89af1c1180e6a42..797bfc6bd526b7489e98046dd2ce752d4f85a0cd 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::toc;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use HTML::Parser;
 
 sub import { #{{{
 use HTML::Parser;
 
 sub import { #{{{
index 7318731c54808c01ee73ec4b8b660708bb8a066a..4a16ef32c70db4c7f188e8790be78e285cfdf55e 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::toggle;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 # Here's the javascript that makes this possible. A key feature is the use
 # of css to hide toggleables, to avoid any flashing on page load. The css
 
 # Here's the javascript that makes this possible. A key feature is the use
 # of css to hide toggleables, to avoid any flashing on page load. The css
index 682dadab7bb7cddc7c960eb9beffcef05a43f5d6..3b66ab0d087e871e8152992552ade197610c8039 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::typography;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        IkiWiki::hook(type => "sanitize", id => "typography", call => \&sanitize);
 
 sub import { #{{{
        IkiWiki::hook(type => "sanitize", id => "typography", call => \&sanitize);
index 586be087415f23df6ea5dc66e2395d29483c5b3c..e1d346ae67d19962fc732759e540c17776d8f2a6 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::wikitext;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "htmlize", id => "wiki", call => \&htmlize);
 
 sub import { #{{{
        hook(type => "htmlize", id => "wiki", call => \&htmlize);
index e77379a65e528114d49381c9d8c2e1286bc1e59e..0b7e00d9d0af606f3bd5e0483fd29bb749969f4f 100644 (file)
@@ -365,7 +365,7 @@ sub refresh () { #{{{
                                foreach my $file (keys %rendered, @del) {
                                        next if $f eq $file;
                                        my $page=pagename($file);
                                foreach my $file (keys %rendered, @del) {
                                        next if $f eq $file;
                                        my $page=pagename($file);
-                                       if (pagespec_match($page, $depends{$p}, $p)) {
+                                       if (pagespec_match($page, $depends{$p}, location => $p)) {
                                                debug(sprintf(gettext("rendering %s, which depends on %s"), $f, $page));
                                                render($f);
                                                $rendered{$f}=1;
                                                debug(sprintf(gettext("rendering %s, which depends on %s"), $f, $page));
                                                render($f);
                                                $rendered{$f}=1;
index 8bd056248ff1ee02884fc7f6847b9e9dc83ad8f1..d0ef578c240a4a021afa424a8d7c8beb9246469a 100644 (file)
@@ -92,11 +92,8 @@ sub set_banned_users (@) { #{{{
        return userinfo_store($userinfo);
 } #}}}
 
        return userinfo_store($userinfo);
 } #}}}
 
-# Global used to pass information into the PageSpec function.
-our $committer;
-
 sub commit_notify_list ($@) { #{{{
 sub commit_notify_list ($@) { #{{{
-       $committer=shift;
+       my $committer=shift;
        my @pages = map pagename($_), @_;
 
        my @ret;
        my @pages = map pagename($_), @_;
 
        my @ret;
@@ -107,7 +104,9 @@ sub commit_notify_list ($@) { #{{{
                    length $userinfo->{$user}->{subscriptions} &&
                    exists $userinfo->{$user}->{email} &&
                    length $userinfo->{$user}->{email} &&
                    length $userinfo->{$user}->{subscriptions} &&
                    exists $userinfo->{$user}->{email} &&
                    length $userinfo->{$user}->{email} &&
-                   grep { pagespec_match($_, $userinfo->{$user}->{subscriptions}, "") }
+                   grep { pagespec_match($_,
+                                   $userinfo->{$user}->{subscriptions}, 
+                                   user => $committer) }
                        map pagename($_), @_) {
                        push @ret, $userinfo->{$user}->{email};
                }
                        map pagename($_), @_) {
                        push @ret, $userinfo->{$user}->{email};
                }
@@ -180,13 +179,4 @@ sub send_commit_mails ($$$@) { #{{{
        }
 } #}}}
 
        }
 } #}}}
 
-package IkiWiki::PageSpec;
-
-sub match_user ($$$) { #{{{
-       shift;
-       my $user=shift;
-
-       return $user eq $committer;
-} #}}}
-
 1
 1
index 2ebb385b8b9ab96b16f3e3a2487b4bff6a2bda82..739b764844abf4756a919007bf5a8650b491378e 100644 (file)
@@ -22,8 +22,15 @@ ikiwiki (1.51) UNRELEASED; urgency=low
   * Avoid .svn directories when installing from svn checkout.
   * Fix sending of commit mails when new pages are added via the web.
   * Add user(name) to the PageSpec for commit subscriptions.
   * Avoid .svn directories when installing from svn checkout.
   * Fix sending of commit mails when new pages are added via the web.
   * Add user(name) to the PageSpec for commit subscriptions.
-
- -- Joey Hess <joeyh@debian.org>  Thu, 26 Apr 2007 20:25:53 -0400
+  * pagespec_match() has changed to take named parameters, to better allow
+    for extended pagespecs. The old calling convention will still work for
+    back-compat for now.
+  * The calling convention for functions in the IkiWiki::PageSpec namespace
+    has changed so they are passed named parameters.
+  * Plugin interface version increased to 2.00 since I don't anticipate any
+    more interface changes before 2.0.
+
+ -- Joey Hess <joeyh@debian.org>  Thu, 26 Apr 2007 22:18:47 -0400
 
 ikiwiki (1.50) unstable; urgency=low
 
 
 ikiwiki (1.50) unstable; urgency=low
 
index 4dd057074a652c2f24ccc7ac33daa79ad81601d3..d9f25641d9d1ae82e888543902e5d61d91293a96 100644 (file)
@@ -20,6 +20,8 @@ being edited.
 ## Registering plugins
 
 All plugins should `use IkiWiki` to import the ikiwiki plugin interface.
 ## Registering plugins
 
 All plugins should `use IkiWiki` to import the ikiwiki plugin interface.
+It's a good idea to include the version number of the plugin interface that
+your plugin expects: `use IkiWiki 2.00`
 
 Plugins should, when imported, call `hook()` to hook into ikiwiki's
 processing. The function uses named parameters, and use varies depending on
 
 Plugins should, when imported, call `hook()` to hook into ikiwiki's
 processing. The function uses named parameters, and use varies depending on
@@ -316,12 +318,15 @@ page created from it. (Ie, it appends ".html".)
 
 Makes the specified page depend on the specified [[PageSpec]].
 
 
 Makes the specified page depend on the specified [[PageSpec]].
 
-#### `pagespec_match($$;$)`
+#### `pagespec_match($$;@)`
 
 
-Passed a page name, a [[PageSpec]], and the location the [[PageSpec]] should
-be matched against, returns true if the [[PageSpec]] matches the page. (If
-the third parameter is not passed, relative PageSpecs will match relative to
-the top of the wiki.)
+Passed a page name, and [[PageSpec]], returns true if the [[PageSpec]]
+matches the page.
+
+Additional named parameters can be passed, to further limit the match.
+The most often used is "location", which specifies the location the
+PageSpec should match against. If not passed, relative PageSpecs will match
+relative to the top of the wiki.
 
 #### `bestlink($$)`
 
 
 #### `bestlink($$)`
 
@@ -441,6 +446,6 @@ It's also possible to write plugins that add new functions to
 [[PageSpecs|PageSpec]]. Such a plugin should add a function to the
 IkiWiki::PageSpec package, that is named `match_foo`, where "foo()" is
 how it will be accessed in a [[PageSpec]]. The function will be passed
 [[PageSpecs|PageSpec]]. Such a plugin should add a function to the
 IkiWiki::PageSpec package, that is named `match_foo`, where "foo()" is
 how it will be accessed in a [[PageSpec]]. The function will be passed
-three parameters: The name of the page being matched, the thing to match
-against, and the page that the matching is occuring on. It should return
+two parameters: The name of the page being matched, and the thing to match
+against. It may also be passed additional, named parameters. It should return
 true if the page matches.
 true if the page matches.
index 28d837cf313697a6daa0c7b3a52f7a3b1a5dff28..64af1d2a93cf4d4ce2ae9e3cfcf36d0862b26d5a 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-04-26 20:28-0400\n"
+"POT-Creation-Date: 2007-04-26 22:52-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -119,7 +119,7 @@ msgstr ""
 msgid "There are no broken links!"
 msgstr ""
 
 msgid "There are no broken links!"
 msgstr ""
 
-#: ../IkiWiki/Plugin/conditional.pm:20
+#: ../IkiWiki/Plugin/conditional.pm:17
 msgid "\"test\" and \"then\" parameters are required"
 msgstr ""
 
 msgid "\"test\" and \"then\" parameters are required"
 msgstr ""
 
@@ -397,23 +397,23 @@ msgstr ""
 msgid "failed to run php"
 msgstr ""
 
 msgid "failed to run php"
 msgstr ""
 
-#: ../IkiWiki/Plugin/table.pm:22
+#: ../IkiWiki/Plugin/table.pm:21
 msgid "cannot find file"
 msgstr ""
 
 msgid "cannot find file"
 msgstr ""
 
-#: ../IkiWiki/Plugin/table.pm:45
+#: ../IkiWiki/Plugin/table.pm:44
 msgid "unknown data format"
 msgstr ""
 
 msgid "unknown data format"
 msgstr ""
 
-#: ../IkiWiki/Plugin/table.pm:53
+#: ../IkiWiki/Plugin/table.pm:52
 msgid "empty data"
 msgstr ""
 
 msgid "empty data"
 msgstr ""
 
-#: ../IkiWiki/Plugin/table.pm:73
+#: ../IkiWiki/Plugin/table.pm:72
 msgid "Direct data download"
 msgstr ""
 
 msgid "Direct data download"
 msgstr ""
 
-#: ../IkiWiki/Plugin/table.pm:106
+#: ../IkiWiki/Plugin/table.pm:105
 #, perl-format
 msgid "parse fail at line %d: %s"
 msgstr ""
 #, perl-format
 msgid "parse fail at line %d: %s"
 msgstr ""
@@ -513,7 +513,7 @@ msgstr ""
 #. translators: A list of one or more pages that were changed,
 #. translators: And the name of the user making the change.
 #. translators: This is used as the subject of a commit email.
 #. translators: A list of one or more pages that were changed,
 #. translators: And the name of the user making the change.
 #. translators: This is used as the subject of a commit email.
-#: ../IkiWiki/UserInfo.pm:146
+#: ../IkiWiki/UserInfo.pm:145
 #, perl-format
 msgid "update of %s's %s by %s"
 msgstr ""
 #, perl-format
 msgid "update of %s's %s by %s"
 msgstr ""
index 09e9582d16a655c61911300c5e3074671a718ff1..eac2395edd5553c8e33d1fc14a6c1b6847aaf1a0 100755 (executable)
@@ -1,29 +1,30 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More tests => 46;
+use Test::More tests => 49;
 
 BEGIN { use_ok("IkiWiki"); }
 
 
 BEGIN { use_ok("IkiWiki"); }
 
-ok(pagespec_match("foo", "*", ""));
-ok(pagespec_match("page", "?ag?", ""));
-ok(! pagespec_match("page", "?a?g?", ""));
-ok(pagespec_match("foo.png", "*.*", ""));
-ok(! pagespec_match("foo", "*.*", ""));
-ok(pagespec_match("foo", "foo or bar", ""), "simple list");
-ok(pagespec_match("bar", "foo or bar", ""), "simple list 2");
-ok(pagespec_match("foo", "f?? and !foz", ""));
-ok(! pagespec_match("foo", "f?? and !foo", ""));
-ok(! pagespec_match("foo", "* and !foo", ""));
-ok(! pagespec_match("foo", "foo and !foo", ""));
-ok(! pagespec_match("foo.png", "* and !*.*", ""));
-ok(pagespec_match("foo", "(bar or ((meep and foo) or (baz or foo) or beep))", ""));
-ok(! pagespec_match("a/foo", "foo", "a/b"), "nonrelative fail");
-ok(! pagespec_match("foo", "./*", "a/b"), "relative fail");
-ok(pagespec_match("a/foo", "./*", "a/b"), "relative");
-ok(pagespec_match("a/b/foo", "./*", "a/b"), "relative 2");
-ok(pagespec_match("foo", "./*", "a"), "relative toplevel");
-ok(pagespec_match("foo/bar", "*", "baz"), "absolute");
+ok(pagespec_match("foo", "*"));
+ok(pagespec_match("page", "?ag?"));
+ok(! pagespec_match("page", "?a?g?"));
+ok(pagespec_match("foo.png", "*.*"));
+ok(! pagespec_match("foo", "*.*"));
+ok(pagespec_match("foo", "foo or bar"), "simple list");
+ok(pagespec_match("bar", "foo or bar"), "simple list 2");
+ok(pagespec_match("foo", "f?? and !foz"));
+ok(! pagespec_match("foo", "f?? and !foo"));
+ok(! pagespec_match("foo", "* and !foo"));
+ok(! pagespec_match("foo", "foo and !foo"));
+ok(! pagespec_match("foo.png", "* and !*.*"));
+ok(pagespec_match("foo", "(bar or ((meep and foo) or (baz or foo) or beep))"));
+ok(! pagespec_match("a/foo", "foo", location => "a/b"), "nonrelative fail");
+ok(! pagespec_match("foo", "./*", location => "a/b"), "relative fail");
+ok(pagespec_match("a/foo", "./*", location => "a/b"), "relative");
+ok(pagespec_match("a/b/foo", "./*", location => "a/b"), "relative 2");
+ok(pagespec_match("a/foo", "./*", "a/b"), "relative oldstyle call");
+ok(pagespec_match("foo", "./*", location => "a"), "relative toplevel");
+ok(pagespec_match("foo/bar", "*", location => "baz"), "absolute");
 
 # The link and backlink stuff needs this.
 $config{userdir}="";
 
 # The link and backlink stuff needs this.
 $config{userdir}="";
@@ -37,16 +38,16 @@ $links{"done"}=[];
 $links{"examples/softwaresite/bugs/fails_to_frobnicate"}=[qw{done}];
 $links{"examples/softwaresite/bugs/done"}=[];
 
 $links{"examples/softwaresite/bugs/fails_to_frobnicate"}=[qw{done}];
 $links{"examples/softwaresite/bugs/done"}=[];
 
-ok(pagespec_match("foo", "link(bar)", ""), "link");
-ok(! pagespec_match("foo", "link(quux)", ""), "failed link");
-ok(pagespec_match("bugs/foo", "link(done)", "bugs/done"), "link match to bestlink");
+ok(pagespec_match("foo", "link(bar)"), "link");
+ok(! pagespec_match("foo", "link(quux)"), "failed link");
+ok(pagespec_match("bugs/foo", "link(done)", location => "bugs/done"), "link match to bestlink");
 ok(! pagespec_match("examples/softwaresite/bugs/done", "link(done)", 
 ok(! pagespec_match("examples/softwaresite/bugs/done", "link(done)", 
-               "bugs/done"), "link match to bestlink");
+               location => "bugs/done"), "link match to bestlink");
 ok(pagespec_match("examples/softwaresite/bugs/fails_to_frobnicate", 
 ok(pagespec_match("examples/softwaresite/bugs/fails_to_frobnicate", 
-               "link(./done)", "examples/softwaresite/bugs/done"), "link relative");
-ok(! pagespec_match("foo", "link(./bar)", "foo/bar"), "link relative fail");
-ok(pagespec_match("bar", "backlink(foo)", ""), "backlink");
-ok(! pagespec_match("quux", "backlink(foo)", ""), "failed backlink");
+               "link(./done)", location => "examples/softwaresite/bugs/done"), "link relative");
+ok(! pagespec_match("foo", "link(./bar)", location => "foo/bar"), "link relative fail");
+ok(pagespec_match("bar", "backlink(foo)"), "backlink");
+ok(! pagespec_match("quux", "backlink(foo)"), "failed backlink");
 
 $IkiWiki::pagectime{foo}=1154532692; # Wed Aug  2 11:26 EDT 2006
 $IkiWiki::pagectime{bar}=1154532695; # after
 
 $IkiWiki::pagectime{foo}=1154532692; # Wed Aug  2 11:26 EDT 2006
 $IkiWiki::pagectime{bar}=1154532695; # after
@@ -63,6 +64,9 @@ ok(! pagespec_match("foo", "creation_day(3)"), "other day");
 
 ok(! pagespec_match("foo", "no_such_function(foo)"), "foo");
 
 
 ok(! pagespec_match("foo", "no_such_function(foo)"), "foo");
 
+ok(pagespec_match("foo", "foo and user(bar)", user => "bar"), "user");
+ok(! pagespec_match("foo", "foo and user(bar)", user => "baz"), "user fail");
+
 # old style globlists
 ok(pagespec_match("foo", "foo bar"), "simple list");
 ok(pagespec_match("bar", "foo bar"), "simple list 2");
 # old style globlists
 ok(pagespec_match("foo", "foo bar"), "simple list");
 ok(pagespec_match("bar", "foo bar"), "simple list 2");