remove globlist support
No transition code implemented, but I will probably make a 2.x release that warns about found globlists.master
parent
c61c99fc77
commit
c07a95ed8e
45
IkiWiki.pm
45
IkiWiki.pm
|
@ -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{
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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]]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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", "* !*.*"));
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue