summaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-01-29 15:05:49 -0500
committerJoey Hess <joey@kodama.kitenet.net>2008-01-29 15:05:49 -0500
commit47ee266163202f15fca3b108fad294bec262405a (patch)
treee83d75d593b57beaaf6ecd41de7fd5a63903d31e /IkiWiki.pm
parent2bfd2e984132e5c235be066070c4e5b14d79b775 (diff)
improve support for internal pages
This makes it a lot quicker to deal with lots of recentchanges pages appearing and disappearing. It avoids needing to clutter up pagespecs with exclusions for those pages, by making normal pagespecs not match them.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm32
1 files changed, 16 insertions, 16 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index c70307b5f..db2605672 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -260,6 +260,12 @@ sub pagetype ($) { #{{{
return;
} #}}}
+sub isinternal ($) { #{{{
+ my $page=shift;
+ return exists $pagesources{$page} &&
+ $pagesources{$page} =~ /\._([^.]+)$/;
+} #}}}
+
sub pagename ($) { #{{{
my $file=shift;
@@ -1287,13 +1293,22 @@ sub match_glob ($$;@) { #{{{
$glob=~s/\\\?/./g;
if ($page=~/^$glob$/i) {
- return IkiWiki::SuccessReason->new("$glob matches $page");
+ if (! IkiWiki::isinternal($page) || $params{internal}) {
+ return IkiWiki::SuccessReason->new("$glob matches $page");
+ }
+ else {
+ return IkiWiki::FailReason->new("$glob matches $page, but the page is an internal page");
+ }
}
else {
return IkiWiki::FailReason->new("$glob does not match $page");
}
} #}}}
+sub match_internal ($$;@) { #{{{
+ return match_glob($_[0], $_[1], @_, internal => 1)
+} #}}}
+
sub match_link ($$;@) { #{{{
my $page=shift;
my $link=lc(shift);
@@ -1389,19 +1404,4 @@ sub match_creation_year ($$;@) { #{{{
}
} #}}}
-sub match_user ($$;@) { #{{{
- shift;
- my $user=shift;
- my %params=@_;
-
- return IkiWiki::FailReason->new('cannot match user')
- unless exists $params{user};
- if ($user eq $params{user}) {
- return IkiWiki::SuccessReason->new("user is $user")
- }
- else {
- return IkiWiki::FailReason->new("user is not $user");
- }
-} #}}}
-
1