aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-10-04 15:34:42 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-10-04 15:42:24 -0400
commit5fd230f9688bf7400f5ef962073bac8bc031e738 (patch)
treea66d722362bd01513c58dc38474af4477f820a38 /IkiWiki.pm
parent6eaf9e40154050936ad9184d64295664da2cc83c (diff)
downloadikiwiki-5fd230f9688bf7400f5ef962073bac8bc031e738.tar
ikiwiki-5fd230f9688bf7400f5ef962073bac8bc031e738.tar.gz
detect pagespecs that require content dependencies
When adding a contentless dependency, the pagespec also needs to be one that does not look at any page content information. As a first approximation of that, only allow glob-based pagespecs in contentless dependencies. While there are probably a few other types of pagespecs that can match contentless, this will work for most of them.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm17
1 files changed, 16 insertions, 1 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 67149bc8b..56e2d4e71 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1774,7 +1774,8 @@ sub add_depends ($$;@) {
my $deptype=$DEPEND_CONTENT | $DEPEND_EXISTS;
if (@_) {
my %params=@_;
- if (defined $params{content} && $params{content} == 0) {
+ if (defined $params{content} && $params{content} == 0 &&
+ pagespec_contentless($pagespec)) {
$deptype=$deptype & ~$DEPEND_CONTENT;
}
}
@@ -1974,6 +1975,20 @@ sub pagespec_valid ($) {
return ! $@;
}
+sub pagespec_contentless ($) {
+ my $spec=shift;
+
+ while ($spec=~m{
+ (\w+)\([^\)]*\) # only match pagespec functions
+ }igx) {
+ # only glob and internal can be matched contentless
+ # (first approximation)
+ return 0 if $1 ne "glob" && $1 ne "internal";
+ }
+
+ return 1;
+}
+
sub glob2re ($) {
my $re=quotemeta(shift);
$re=~s/\\\*/.*/g;