aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-05-06 19:04:56 -0400
committerJoey Hess <joey@kitenet.net>2010-05-06 19:04:56 -0400
commit71b8d2ad4122b7cfe9eda52959e0b2c1f172439c (patch)
treed8c5bcf14cff8f227c2feb7d5b38f0ae8e35a29f
parent7f64ff2ae0e2f2769cf0d0c0c9bc4b370a94b0b7 (diff)
downloadikiwiki-71b8d2ad4122b7cfe9eda52959e0b2c1f172439c.tar
ikiwiki-71b8d2ad4122b7cfe9eda52959e0b2c1f172439c.tar.gz
move meat of type checking to match_page where it belongs
-rw-r--r--IkiWiki.pm15
1 files changed, 9 insertions, 6 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index ee1ecb58f..43995fc96 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -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 ($$;@) {