change how dependency types are specified to add_depends

Also, this fixes 2 bugs in dependency info.
master
Joey Hess 2009-10-08 16:49:03 -04:00
parent f2b3d13414
commit c57908b9d0
13 changed files with 30 additions and 23 deletions

View File

@ -24,7 +24,7 @@ sub preprocess (@) {
$params{pages}="*" unless defined $params{pages};
# Needs to update whenever the links on a page change.
add_depends($params{page}, $params{pages}, links => 1);
add_depends($params{page}, $params{pages}, deptype("links"));
my @broken;
foreach my $link (keys %IkiWiki::brokenlinks) {

View File

@ -105,21 +105,21 @@ sub format_month (@) {
linktext => " $monthname ");
}
add_depends($params{page}, "$archivebase/$year/".sprintf("%02d", $month),
presence => 1);
deptype("presence"));
if (exists $cache{$pagespec}{"$pyear/$pmonth"}) {
$purl = htmllink($params{page}, $params{destpage},
"$archivebase/$pyear/" . sprintf("%02d", $pmonth),
linktext => " $pmonthname ");
}
add_depends($params{page}, "$archivebase/$pyear/".sprintf("%02d", $pmonth),
presence => 1);
deptype("presence"));
if (exists $cache{$pagespec}{"$nyear/$nmonth"}) {
$nurl = htmllink($params{page}, $params{destpage},
"$archivebase/$nyear/" . sprintf("%02d", $nmonth),
linktext => " $nmonthname ");
}
add_depends($params{page}, "$archivebase/$nyear/".sprintf("%02d", $nmonth),
presence => 1);
deptype("presence"));
# Start producing the month calendar
$calendar=<<EOF;
@ -212,7 +212,7 @@ EOF
# Add dependencies to update the calendar whenever pages
# matching the pagespec are added or removed.
add_depends($params{page}, $params{pages}, presence => 1);
add_depends($params{page}, $params{pages}, deptype("presence"));
return $calendar;
}
@ -244,19 +244,19 @@ sub format_year (@) {
"$archivebase/$year",
linktext => "$year");
}
add_depends($params{page}, "$archivebase/$year", presence => 1);
add_depends($params{page}, "$archivebase/$year", deptype("presence");
if (exists $cache{$pagespec}{"$pyear"}) {
$purl = htmllink($params{page}, $params{destpage},
"$archivebase/$pyear",
linktext => "\&larr;");
}
add_depends($params{page}, "$archivebase/$pyear", presence => 1);
add_depends($params{page}, "$archivebase/$pyear", deptype("presence"));
if (exists $cache{$pagespec}{"$nyear"}) {
$nurl = htmllink($params{page}, $params{destpage},
"$archivebase/$nyear",
linktext => "\&rarr;");
}
add_depends($params{page}, "$archivebase/$nyear", presence => 1);
add_depends($params{page}, "$archivebase/$nyear", deptype("presence"));
# Start producing the year calendar
$calendar=<<EOF;
@ -308,7 +308,8 @@ EOF
else {
$calendar.=qq{\t<td class="$tag">$monthabbr</td>\n};
}
add_depends($params{page}, "$archivebase/$year/$mtag", presence => 1);
add_depends($params{page}, "$archivebase/$year/$mtag",
deptype("presence"));
$calendar.=qq{\t</tr>\n} if ($month % $params{months_per_row} == 0);
}

View File

@ -58,7 +58,7 @@ sub preprocess (@) {
$pagestate{$params{page}}{edittemplate}{$params{match}}=$link;
return "" if ($params{silent} && IkiWiki::yesno($params{silent}));
add_depends($params{page}, $link, presence => 1);
add_depends($params{page}, $link, deptype("presence"));
return sprintf(gettext("edittemplate %s registered for %s"),
htmllink($params{page}, $params{destpage}, $link),
$params{match});

View File

@ -195,9 +195,14 @@ sub preprocess_inline (@) {
@list = map { bestlink($params{page}, $_) }
split ' ', $params{pagenames};
foreach my $p (@list) {
add_depends($params{page}, $p, deptype($quick ? "presence" : "content"));
}
}
else {
add_depends($params{page}, $params{pages}, presence => $quick);
add_depends($params{page}, $params{pages},
deptype($quick ? "presence" : "content"));
@list = pagespec_match_list(
[ grep { $_ ne $params{page} } keys %pagesources ],

View File

@ -30,7 +30,7 @@ sub preprocess (@) {
# Needs to update whenever a relevant page is added, or removed, or
# its links change.
add_depends($params{page}, $params{pages}, presence => 1, links => 1);
add_depends($params{page}, $params{pages}, deptype("presence", "links"));
# Can't just return the linkmap here, since the htmlscrubber
# scrubs out all <object> tags (with good reason!)

View File

@ -84,7 +84,7 @@ sub preprocess (@) {
foreach my $plugin (@pluginlist) {
$result .= '<li class="listdirectives">';
my $link=linkpage($config{directive_description_dir}."/".$plugin);
add_depends($params{page}, $link, presence => 1);
add_depends($params{page}, $link, deptype("presence"));
$result .= htmllink($params{page}, $params{destpage}, $link);
$result .= '</li>';
}

View File

@ -70,7 +70,8 @@ sub preprocess (@) {
# Needs to update whenever a page is added or removed (or in some
# cases, when its content changes, if show= is specified), so
# register a dependency.
add_depends($params{page}, $params{pages}, presence => ! exists $params{show});
add_depends($params{page}, $params{pages},
deptype(exists $params{show} ? "content" : "presence");
# Create the map.
my $parent="";

View File

@ -195,7 +195,7 @@ sub preprocess (@) {
if (! length $link) {
error gettext("redir page not found")
}
add_depends($page, $link, presence => 1);
add_depends($page, $link, deptype("presence"));
$value=urlto($link, $page);
$value.='#'.$redir_anchor if defined $redir_anchor;

View File

@ -26,10 +26,10 @@ sub preprocess (@) {
# Needs to update whenever a link changes, on any page
# since any page could link to one of the pages we're
# considering as orphans.
add_depends($params{page}, "*", links => 1);
add_depends($params{page}, "*", deptype("links"));
# Also needs to update whenever potential orphans are added or
# removed.
add_depends($params{page}, $params{pages}, presence => 1);
add_depends($params{page}, $params{pages}, deptype("presence"));
my @orphans;
foreach my $page (pagespec_match_list(

View File

@ -24,7 +24,7 @@ sub preprocess (@) {
# Needs to update count whenever a page is added or removed, so
# register a presence dependency.
add_depends($params{page}, $params{pages}, presence => 1);
add_depends($params{page}, $params{pages}, deptype("presence"));
my @pages;
if ($params{pages} eq "*") {

View File

@ -36,12 +36,12 @@ sub preprocess (@) {
my $style = ($params{style} or 'cloud');
# Needs to update whenever a page is added or removed.
add_depends($params{page}, $params{pages}, exists => 1);
add_depends($params{page}, $params{pages}, deptype("presence"));
# Also needs to update when any page with links changes,
# in case the links point to our displayed pages.
# (Among limits this further.)
add_depends($params{page}, exists $params{among} ? $params{among} : "*",
links => 1);
deptype("links"));
my %counts;
my $max = 0;

View File

@ -48,7 +48,7 @@ sub preprocess (@) {
error gettext("unknown formula");
}
add_depends($params{page}, $params{pages}, presence => 1);
add_depends($params{page}, $params{pages}, deptype("presence"));
my @list=sort { $params{timehash}->{$b} <=> $params{timehash}->{$a} }
pagespec_match_list(

View File

@ -36,8 +36,8 @@ sub preprocess (@) {
$fill.="%";
}
elsif (defined $params{totalpages} and defined $params{donepages}) {
add_depends($params{page}, $params{totalpages}, presence => 1);
add_depends($params{page}, $params{donepages}, presence => 1);
add_depends($params{page}, $params{totalpages}, deptype("presence"));
add_depends($params{page}, $params{donepages}, deptype("presence"));
my @pages=keys %pagesources;
my $totalcount=0;