Auto-detect "simple dependencies" instead of requiring callers to use add_depends_exact()
parent
ec2367cfbf
commit
b6992ec566
16
IkiWiki.pm
16
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
|
pagespec_match_list bestlink htmllink readfile writefile
|
||||||
pagetype srcfile pagename displaytime will_render gettext urlto
|
pagetype srcfile pagename displaytime will_render gettext urlto
|
||||||
targetpage add_underlay pagetitle titlepage linkpage
|
targetpage add_underlay pagetitle titlepage linkpage
|
||||||
newpagefile inject add_link add_depends_exact
|
newpagefile inject add_link
|
||||||
%config %links %pagestate %wikistate %renderedfiles
|
%config %links %pagestate %wikistate %renderedfiles
|
||||||
%pagesources %destsources);
|
%pagesources %destsources);
|
||||||
our $VERSION = 3.00; # plugin interface version, next is ikiwiki version
|
our $VERSION = 3.00; # plugin interface version, next is ikiwiki version
|
||||||
|
@ -1748,19 +1748,19 @@ sub add_depends ($$) {
|
||||||
my $page=shift;
|
my $page=shift;
|
||||||
my $pagespec=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);
|
return unless pagespec_valid($pagespec);
|
||||||
|
|
||||||
$depends{$page}{$pagespec} = 1;
|
$depends{$page}{$pagespec} = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub add_depends_exact ($$) {
|
|
||||||
my $page = shift;
|
|
||||||
my $dep = shift;
|
|
||||||
|
|
||||||
$depends_exact{$page}{$dep} = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub file_pruned ($$) {
|
sub file_pruned ($$) {
|
||||||
require File::Spec;
|
require File::Spec;
|
||||||
my $file=File::Spec->canonpath(shift);
|
my $file=File::Spec->canonpath(shift);
|
||||||
|
|
Loading…
Reference in New Issue