summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2009-08-28 15:41:26 +0100
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2009-08-28 15:41:26 +0100
commitb6992ec56629f4a893c7f016aaa81be25326356b (patch)
treec1044fc000384a3e091b5755855c87ba194f55bb
parentec2367cfbfb0053c61bb394af5ac6f5f930325fd (diff)
Auto-detect "simple dependencies" instead of requiring callers to use add_depends_exact()
-rw-r--r--IkiWiki.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index f6a985556..e4fcf1d6f 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -21,7 +21,7 @@ our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match
pagespec_match_list bestlink htmllink readfile writefile
pagetype srcfile pagename displaytime will_render gettext urlto
targetpage add_underlay pagetitle titlepage linkpage
- newpagefile inject add_link add_depends_exact
+ newpagefile inject add_link
%config %links %pagestate %wikistate %renderedfiles
%pagesources %destsources);
our $VERSION = 3.00; # plugin interface version, next is ikiwiki version
@@ -1748,19 +1748,19 @@ sub add_depends ($$) {
my $page=shift;
my $pagespec=shift;
+ if ($pagespec =~ /$config{wiki_file_regexp}/ &&
+ $pagespec !~ /[\s*?()!]/) {
+ # a simple dependency, which can be matched by string eq
+ $depends_exact{$page}{$pagespec} = 1;
+ return 1;
+ }
+
return unless pagespec_valid($pagespec);
$depends{$page}{$pagespec} = 1;
return 1;
}
-sub add_depends_exact ($$) {
- my $page = shift;
- my $dep = shift;
-
- $depends_exact{$page}{$dep} = 1;
-}
-
sub file_pruned ($$) {
require File::Spec;
my $file=File::Spec->canonpath(shift);