support backlink() in pagespecs for links dependencies

master
Joey Hess 2009-10-06 18:44:59 -04:00
parent 62cc2afcaa
commit 03ae087b43
1 changed files with 32 additions and 11 deletions

View File

@ -1776,21 +1776,42 @@ sub add_depends ($$;@) {
my $simple=$pagespec =~ /$config{wiki_file_regexp}/ && my $simple=$pagespec =~ /$config{wiki_file_regexp}/ &&
$pagespec !~ /[\s*?()!]/; $pagespec !~ /[\s*?()!]/;
my $deptype=$DEPEND_CONTENT; my $deptype=0;
if (@_) { if (@_) {
my %params=@_; my %params=@_;
# Is the pagespec limited to terms that will continue if ($params{presence}) {
# to match pages as long as those pages exist? # Is the pagespec limited to terms that will continue
my $limited=1; # to match pages as long as those pages exist?
while ($limited && $pagespec=~m/(\w+)\([^\)]*\)/g) { my $presence_limited=1;
$limited = $1 =~ /^(glob|internal|creation_month|creation_day|creation_year|created_before|created_after)$/; while ($presence_limited && $pagespec=~m/(\w+)\([^\)]*\)/g) {
$presence_limited = $1 =~ /^(glob|internal|creation_month|creation_day|creation_year|created_before|created_after)$/;
}
if ($presence_limited) {
$deptype=$deptype | $DEPEND_PRESENCE;
}
else {
$deptype=$deptype | $DEPEND_CONTENT;
}
} }
if ($params{links}) {
$deptype=$deptype & ~$DEPEND_CONTENT | $DEPEND_PRESENCE # Is the pagespec limited to terms that will continue
if $params{presence} && $limited; # to match pages as long as those pages exist and
$deptype=$deptype & ~$DEPEND_CONTENT | $DEPEND_LINKS # link to the same places?
if $params{links} && $limited; my $links_limited=1;
while ($links_limited && $pagespec=~m/(\w+)\([^\)]*\)/g) {
$links_limited = $1 =~ /^(glob|internal|creation_month|creation_day|creation_year|created_before|created_after|backlink)$/;
}
if ($links_limited) {
$deptype=$deptype | $DEPEND_LINKS;
}
else {
$deptype=$deptype | $DEPEND_CONTENT;
}
}
}
else {
$deptype=$DEPEND_CONTENT;
} }
if ($simple) { if ($simple) {