From: joey Date: Wed, 7 Feb 2007 00:45:00 +0000 (+0000) Subject: fixes and more tests X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/commitdiff_plain/d472e293cd1c8b15e79b7075be1068bba3ec4af1?ds=sidebyside fixes and more tests --- diff --git a/IkiWiki.pm b/IkiWiki.pm index a547c57ef..32ca0449f 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -881,7 +881,7 @@ sub match_glob ($$$) { #{{{ if ($glob =~ m!^\./!) { $from=~s!/?[^/]+$!!; $glob=~s!^\./!!; - $glob="$from/$glob"; + $glob="$from/$glob" if length $from; } # turn glob into safe regexp diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index d822408c2..1aaaf1d1e 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -314,9 +314,9 @@ Makes the specified page depend on the specified [[PageSpec]]. #### `pagespec_match($$;$)` -Passed a page name, a [[PageSpec]], and the location the glob 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 +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.) #### `bestlink($$)` diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 7ec22a689..6fd3644e8 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-02-06 15:59-0500\n" +"POT-Creation-Date: 2007-02-06 19:43-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/t/pagespec_match.t b/t/pagespec_match.t index 1b8143577..bd517f58b 100755 --- a/t/pagespec_match.t +++ b/t/pagespec_match.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 40; +use Test::More tests => 41; BEGIN { use_ok("IkiWiki"); } @@ -18,10 +18,11 @@ 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("foo/bar", "./*", "foo"), "relative fail"); -ok(! pagespec_match("a/foo", "./*", "a/b"), "relative"); -ok(! pagespec_match("a/b/foo", "./*", "a/b"), "relative fail"); -ok(! pagespec_match("foo", "./*", "a"), "relative toplevel"); +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"); $links{foo}=[qw{bar baz}];