remove globlist support
authorJoey Hess <joey@gnu.kitenet.net>
Tue, 23 Dec 2008 22:11:04 +0000 (17:11 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Tue, 23 Dec 2008 22:11:04 +0000 (17:11 -0500)
No transition code implemented, but I will probably make a 2.x release that
warns about found globlists.

IkiWiki.pm
doc/ikiwiki/pagespec.mdwn
doc/plugins/contrib.mdwn
doc/tips/upgrade_to_3.0.mdwn
t/pagespec_match.t
t/pagespec_merge.t

index 759bfbc658f971ddfa4e23845f328ec8d600d9ce..f6adb360a56bcac7fca9e65e7551f6cb92c77328 100644 (file)
@@ -1596,37 +1596,6 @@ sub rcs_receive () {
        $hooks{rcs}{rcs_receive}{call}->();
 }
 
-sub globlist_to_pagespec ($) {
-       my @globlist=split(' ', shift);
-
-       my (@spec, @skip);
-       foreach my $glob (@globlist) {
-               if ($glob=~/^!(.*)/) {
-                       push @skip, $glob;
-               }
-               else {
-                       push @spec, $glob;
-               }
-       }
-
-       my $spec=join(' or ', @spec);
-       if (@skip) {
-               my $skip=join(' and ', @skip);
-               if (length $spec) {
-                       $spec="$skip and ($spec)";
-               }
-               else {
-                       $spec=$skip;
-               }
-       }
-       return $spec;
-}
-
-sub is_globlist ($) {
-       my $s=shift;
-       return ( $s =~ /[^\s]+\s+([^\s]+)/ && $1 ne "and" && $1 ne "or" );
-}
-
 sub safequote ($) {
        my $s=shift;
        $s=~s/[{}]//g;
@@ -1718,26 +1687,12 @@ sub pagespec_merge ($$) {
        my $b=shift;
 
        return $a if $a eq $b;
-
-        # Support for old-style GlobLists.
-        if (is_globlist($a)) {
-                $a=globlist_to_pagespec($a);
-        }
-        if (is_globlist($b)) {
-                $b=globlist_to_pagespec($b);
-        }
-
        return "($a) or ($b)";
 }
 
 sub pagespec_translate ($) {
        my $spec=shift;
 
-       # Support for old-style GlobLists.
-       if (is_globlist($spec)) {
-               $spec=globlist_to_pagespec($spec);
-       }
-
        # Convert spec to perl code.
        my $code="";
        while ($spec=~m{
index d4dd265cc79a9e38701fedc12f787041754c4e48..86abe574564c3e43f9f590bd60be5024661ffe1b 100644 (file)
@@ -72,22 +72,3 @@ filenames of the pages in the wiki, so a pagespec "foo" used on page
 "a/b" will not match a page named "a/foo" or "a/b/foo". To match
 relative to the directory of the page containing the pagespec, you can
 use "./". For example, "./foo" on page "a/b" matches page "a/foo".
-
-## Old syntax
-
-The old PageSpec syntax was called a "GlobList", and worked differently in
-two ways:
-
-1. "and" and "or" were not used; any page matching any item from the list
-   matched.
-2. If an item was prefixed with "`!`", then no page matching that item
-   matched, even if it matched an earlier list item.
-
-For example, here is the old way to match all pages except for the SandBox
-and Discussion pages:
-
-       * !SandBox !*/Discussion
-
-Using this old syntax is still supported. However, the old syntax is
-deprecated and will be removed at some point, and using the new syntax is
-recommended.
index 7a28edaba136ae13b8b462c9302958c240c990f6..e22b13f713b0ffc25ff2f9c56e25814789ee1154 100644 (file)
@@ -2,6 +2,6 @@ Contributed [[plugins]]:
 
 (See [[install]] for installation help.)
 
-[[!inline pages="plugins/contrib/* !*/Discussion" 
+[[!inline pages="plugins/contrib/* and !*/Discussion" 
 feedpages="created_after(plugins/contrib/navbar)" archive="yes"
 rootpage="plugins/contrib" postformtext="Add a new plugin named:" show=0]]
index 6c74d4fc9a76189fdee716095c46e91c67124b64..bd47e96e594a754221b66067fc711bf844566b85 100644 (file)
@@ -49,6 +49,23 @@ Be sure to modify the find to list all pages in the wiki if you're using
 other markup than markdown. You will probably want to commit the changes
 when you're done too.
 
+## GlobLists
+
+In 3.0, the old "GlobList" syntax for [[PageSpecs|ikiwiki/PageSpec]] is no
+longer supported. A GlobList contains multiple term, but does not separate
+them with "and" or "or":
+
+       sandbox !*/Discussion
+
+To convert this to a modern PageSpec, simply add "and" or "or" as
+appropriate between terms:
+       
+       sandbox and !*/Discussion
+
+GlobLists have been deprecated for more than two years. If your wiki dates
+to the ikiwiki 1.0 era, you should check it for any that might have lurked
+unnoticed in it since back then.
+
 ## aggregateinternal
 
 If your wiki uses the [[aggregate|plugins/aggregate]] plugin, it will start
index 7c0ac235b8b522391885816d76040f88a79a6406..69cf361de4ed6aa4fa3cb591aa5c3481cab46a49 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More tests => 58;
+use Test::More tests => 51;
 
 BEGIN { use_ok("IkiWiki"); }
 
@@ -77,12 +77,3 @@ ok(! pagespec_match("foo", "no_such_function(foo)"), "foo");
 my $ret=pagespec_match("foo", "(invalid");
 ok(! $ret, "syntax error");
 ok($ret =~ /syntax error/, "error message");
-
-# old style globlists
-ok(pagespec_match("foo", "foo bar"), "simple list");
-ok(pagespec_match("bar", "foo bar"), "simple list 2");
-ok(pagespec_match("foo", "f?? !foz"));
-ok(! pagespec_match("foo", "f?? !foo"));
-ok(! pagespec_match("foo", "* !foo"));
-ok(! pagespec_match("foo", "foo !foo"));
-ok(! pagespec_match("foo.png", "* !*.*"));
index cbb06219c15184d82caf320b5842f16de74daf6a..9e38d576164c184ada3bd48646126fe818259250 100755 (executable)
@@ -28,17 +28,17 @@ ok(same("!foo", "!bar", "foo"), "double inversion failed match");
 ok(same("!foo", "!bar", "bar"), "double inversion failed match 2");
 ok(same("*", "!bar", "foo"), "glob+inversion match");
 ok(same("*", "!bar", "bar"), "matching glob and matching inversion");
-ok(same("* !foo", "!bar", "bar"), "matching glob and matching inversion");
-ok(same("* !foo", "!bar", "foo"), "matching glob with matching inversion and non-matching inversion");
-ok(same("* !foo", "!foo", "foo"), "matching glob with matching inversion and matching inversion");
+ok(same("* and !foo", "!bar", "bar"), "matching glob and matching inversion");
+ok(same("* and !foo", "!bar", "foo"), "matching glob with matching inversion and non-matching inversion");
+ok(same("* and !foo", "!foo", "foo"), "matching glob with matching inversion and matching inversion");
 ok(same("b??", "!b??", "bar"), "matching glob and matching inverted glob");
 ok(same("f?? !f??", "!bar", "bar"), "matching glob and matching inverted glob");
 ok(same("b??", "!b?z", "bar"), "matching glob and non-matching inverted glob");
 ok(same("f?? !f?z", "!bar", "bar"), "matching glob and non-matching inverted glob");
 ok(same("!foo bar baz", "!bar", "bar"), "matching list and matching inversion");
 ok(pagespec_match("foo/Discussion",
-       IkiWiki::pagespec_merge("* !*/Discussion", "*/Discussion")), "should match");
-ok(same("* !*/Discussion", "*/Discussion", "foo/Discussion"), "Discussion merge 1");
-ok(same("*/Discussion", "* !*/Discussion", "foo/Discussion"), "Discussion merge 2");
+       IkiWiki::pagespec_merge("* and !*/Discussion", "*/Discussion")), "should match");
+ok(same("* and !*/Discussion", "*/Discussion", "foo/Discussion"), "Discussion merge 1");
+ok(same("*/Discussion", "* and !*/Discussion", "foo/Discussion"), "Discussion merge 2");
 ok(same("*/Discussion !*/bar", "*/bar !*/Discussion", "foo/Discussion"), "bidirectional merge 1");
 ok(same("*/Discussion !*/bar", "*/bar !*/Discussion", "foo/bar"), "bidirectional merge 2");