]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
move meat of type checking to match_page where it belongs
authorJoey Hess <joey@kitenet.net>
Thu, 6 May 2010 23:04:56 +0000 (19:04 -0400)
committerJoey Hess <joey@kitenet.net>
Thu, 6 May 2010 23:04:56 +0000 (19:04 -0400)
IkiWiki.pm

index ee1ecb58f36003ec681f64fab13b5038fdfb43ad..43995fc9665a3768b88ec7919862e49972bcf1ca 100644 (file)
@@ -2329,11 +2329,7 @@ sub match_glob ($$;@) {
 
        my $regexp=IkiWiki::glob2re($glob);
        if ($page=~/^$regexp$/i) {
-               if ($params{onlypage} &&
-                   ! defined IkiWiki::pagetype($IkiWiki::pagesources{$page})) {
-                       return IkiWiki::FailReason->new("$page is not a page");
-               }
-               elsif (! IkiWiki::isinternal($page) || $params{internal}) {
+               if (! IkiWiki::isinternal($page) || $params{internal}) {
                        return IkiWiki::SuccessReason->new("$glob matches $page");
                }
                else {
@@ -2350,7 +2346,14 @@ sub match_internal ($$;@) {
 }
 
 sub match_page ($$;@) {
-       return match_glob($_[0], $_[1], @_, onlypage => 1)
+       my $page=shift;
+       my $match=match_glob($page, $_[1], @_);
+       if ($match && ! defined IkiWiki::pagetype($IkiWiki::pagesources{$page})) {
+               return IkiWiki::FailReason->new("$page is not a page");
+       }
+       else {
+               return $match;
+       }
 }
 
 sub match_link ($$;@) {