aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/brokenlinks.pm5
-rw-r--r--IkiWiki/Plugin/calendar.pm21
-rw-r--r--IkiWiki/Plugin/edittemplate.pm2
-rw-r--r--IkiWiki/Plugin/inline.pm7
-rw-r--r--IkiWiki/Plugin/linkmap.pm8
-rw-r--r--IkiWiki/Plugin/listdirectives.pm2
-rw-r--r--IkiWiki/Plugin/map.pm8
-rw-r--r--IkiWiki/Plugin/meta.pm10
-rw-r--r--IkiWiki/Plugin/orphans.pm10
-rw-r--r--IkiWiki/Plugin/pagecount.pm4
-rw-r--r--IkiWiki/Plugin/pagestats.pm13
-rw-r--r--IkiWiki/Plugin/postsparkline.pm2
-rw-r--r--IkiWiki/Plugin/progress.pm4
13 files changed, 52 insertions, 44 deletions
diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm
index eb698b0be..9e65f52c6 100644
--- a/IkiWiki/Plugin/brokenlinks.pm
+++ b/IkiWiki/Plugin/brokenlinks.pm
@@ -23,9 +23,8 @@ sub preprocess (@) {
my %params=@_;
$params{pages}="*" unless defined $params{pages};
- # Needs to update whenever a page is added or removed, so
- # register a dependency.
- add_depends($params{page}, $params{pages});
+ # Needs to update whenever the links on a page change.
+ add_depends($params{page}, $params{pages}, links => 1);
my @broken;
foreach my $link (keys %IkiWiki::brokenlinks) {
diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
index 5d16dff75..a1117992a 100644
--- a/IkiWiki/Plugin/calendar.pm
+++ b/IkiWiki/Plugin/calendar.pm
@@ -104,19 +104,22 @@ sub format_month (@) {
"$archivebase/$year/".sprintf("%02d", $month),
linktext => " $monthname ");
}
- add_depends($params{page}, "$archivebase/$year/".sprintf("%02d", $month));
+ add_depends($params{page}, "$archivebase/$year/".sprintf("%02d", $month),
+ presence => 1);
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));
+ add_depends($params{page}, "$archivebase/$pyear/".sprintf("%02d", $pmonth),
+ presence => 1);
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));
+ add_depends($params{page}, "$archivebase/$nyear/".sprintf("%02d", $nmonth),
+ presence => 1);
# Start producing the month calendar
$calendar=<<EOF;
@@ -209,11 +212,11 @@ EOF
# Add dependencies to update the calendar whenever pages
# matching the pagespec are added or removed.
- add_depends($params{page}, $params{pages});
+ add_depends($params{page}, $params{pages}, presence => 1);
# Explicitly add all currently linked pages as dependencies, so
# that if they are removed, the calendar will be sure to be updated.
foreach my $p (@list) {
- add_depends($params{page}, $p);
+ add_depends($params{page}, $p, presence => 1);
}
return $calendar;
@@ -246,19 +249,19 @@ sub format_year (@) {
"$archivebase/$year",
linktext => "$year");
}
- add_depends($params{page}, "$archivebase/$year");
+ add_depends($params{page}, "$archivebase/$year", presence => 1);
if (exists $cache{$pagespec}{"$pyear"}) {
$purl = htmllink($params{page}, $params{destpage},
"$archivebase/$pyear",
linktext => "\&larr;");
}
- add_depends($params{page}, "$archivebase/$pyear");
+ add_depends($params{page}, "$archivebase/$pyear", presence => 1);
if (exists $cache{$pagespec}{"$nyear"}) {
$nurl = htmllink($params{page}, $params{destpage},
"$archivebase/$nyear",
linktext => "\&rarr;");
}
- add_depends($params{page}, "$archivebase/$nyear");
+ add_depends($params{page}, "$archivebase/$nyear", presence => 1);
# Start producing the year calendar
$calendar=<<EOF;
@@ -310,7 +313,7 @@ EOF
else {
$calendar.=qq{\t<td class="$tag">$monthabbr</td>\n};
}
- add_depends($params{page}, "$archivebase/$year/$mtag");
+ add_depends($params{page}, "$archivebase/$year/$mtag", presence => 1);
$calendar.=qq{\t</tr>\n} if ($month % $params{months_per_row} == 0);
}
diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm
index 0bafc95d0..2dd1dbe68 100644
--- a/IkiWiki/Plugin/edittemplate.pm
+++ b/IkiWiki/Plugin/edittemplate.pm
@@ -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);
+ add_depends($params{page}, $link, presence => 1);
return sprintf(gettext("edittemplate %s registered for %s"),
htmllink($params{page}, $params{destpage}, $link),
$params{match});
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index ccfadfd69..cebd9037c 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -197,7 +197,7 @@ sub preprocess_inline (@) {
split ' ', $params{pagenames};
}
else {
- add_depends($params{page}, $params{pages});
+ add_depends($params{page}, $params{pages}, presence => $quick);
@list = pagespec_match_list(
[ grep { $_ ne $params{page} } keys %pagesources ],
@@ -248,10 +248,9 @@ sub preprocess_inline (@) {
}
# Explicitly add all currently displayed pages as dependencies, so
- # that if they are removed or otherwise changed, the inline will be
- # sure to be updated.
+ # that if they are removed, the inline will be sure to be updated.
foreach my $p ($#list >= $#feedlist ? @list : @feedlist) {
- add_depends($params{page}, $p);
+ add_depends($params{page}, $p, presence => $quick);
}
if ($feeds && exists $params{feedpages}) {
diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm
index 941ed5f36..3d20a6521 100644
--- a/IkiWiki/Plugin/linkmap.pm
+++ b/IkiWiki/Plugin/linkmap.pm
@@ -28,9 +28,9 @@ sub preprocess (@) {
$params{pages}="*" unless defined $params{pages};
- # Needs to update whenever a page is added or removed, so
- # register a dependency.
- add_depends($params{page}, $params{pages});
+ # 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);
# Can't just return the linkmap here, since the htmlscrubber
# scrubs out all <object> tags (with good reason!)
@@ -56,7 +56,7 @@ sub genmap ($) {
# Get all the items to map.
my %mapitems = ();
- foreach my $item (keys %links) {
+ foreach my $item (keys %pagesources) {
if (pagespec_match($item, $params{pages}, location => $params{page})) {
$mapitems{$item}=urlto($item, $params{destpage});
}
diff --git a/IkiWiki/Plugin/listdirectives.pm b/IkiWiki/Plugin/listdirectives.pm
index bd73f1a04..4023ed7d7 100644
--- a/IkiWiki/Plugin/listdirectives.pm
+++ b/IkiWiki/Plugin/listdirectives.pm
@@ -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);
+ add_depends($params{page}, $link, presence => 1);
$result .= htmllink($params{page}, $params{destpage}, $link);
$result .= '</li>';
}
diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm
index 54146dc46..625cfdfca 100644
--- a/IkiWiki/Plugin/map.pm
+++ b/IkiWiki/Plugin/map.pm
@@ -68,13 +68,13 @@ sub preprocess (@) {
}
# Needs to update whenever a page is added or removed (or in some
- # cases, when its content changes, if show=title), so register a
- # dependency.
- add_depends($params{page}, $params{pages});
+ # cases, when its content changes, if show= is specified), so
+ # register a dependency.
+ add_depends($params{page}, $params{pages}, presence => ! exists $params{show});
# Explicitly add all currently shown pages, to detect when pages
# are removed.
foreach my $item (keys %mapitems) {
- add_depends($params{page}, $item);
+ add_depends($params{page}, $item, presence => ! exists $params{show});
}
# Create the map.
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 514b09369..a8ee5bc85 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -195,7 +195,7 @@ sub preprocess (@) {
if (! length $link) {
error gettext("redir page not found")
}
- add_depends($page, $link);
+ add_depends($page, $link, presence => 1);
$value=urlto($link, $page);
$value.='#'.$redir_anchor if defined $redir_anchor;
@@ -291,21 +291,21 @@ sub match {
if (defined $val) {
if ($val=~/^$re$/i) {
- return IkiWiki::SuccessReason->new("$re matches $field of $page");
+ return IkiWiki::SuccessReason->new("$re matches $field of $page", $page);
}
else {
- return IkiWiki::FailReason->new("$re does not match $field of $page");
+ return IkiWiki::FailReason->new("$re does not match $field of $page", $page);
}
}
else {
- return IkiWiki::FailReason->new("$page does not have a $field");
+ return IkiWiki::FailReason->new("$page does not have a $field", $page);
}
}
package IkiWiki::PageSpec;
sub match_title ($$;@) {
- IkiWiki::Plugin::meta::match("title", @_);
+ IkiWiki::Plugin::meta::match("title", @_);
}
sub match_author ($$;@) {
diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm
index 711226772..ae330b23b 100644
--- a/IkiWiki/Plugin/orphans.pm
+++ b/IkiWiki/Plugin/orphans.pm
@@ -23,9 +23,13 @@ sub preprocess (@) {
my %params=@_;
$params{pages}="*" unless defined $params{pages};
- # Needs to update whenever a page is added or removed, so
- # register a dependency.
- add_depends($params{page}, $params{pages});
+ # 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);
+ # Also needs to update whenever potential orphans are added or
+ # removed.
+ add_depends($params{page}, $params{pages}, presence => 1);
my @orphans;
foreach my $page (pagespec_match_list(
diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm
index 5a2301af4..80561350b 100644
--- a/IkiWiki/Plugin/pagecount.pm
+++ b/IkiWiki/Plugin/pagecount.pm
@@ -23,8 +23,8 @@ sub preprocess (@) {
$params{pages}="*" unless defined $params{pages};
# Needs to update count whenever a page is added or removed, so
- # register a dependency.
- add_depends($params{page}, $params{pages});
+ # register a presence dependency.
+ add_depends($params{page}, $params{pages}, presence => 1);
my @pages;
if ($params{pages} eq "*") {
diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm
index 874ead7e6..afe4eeaf2 100644
--- a/IkiWiki/Plugin/pagestats.pm
+++ b/IkiWiki/Plugin/pagestats.pm
@@ -35,14 +35,17 @@ sub preprocess (@) {
$params{pages}="*" unless defined $params{pages};
my $style = ($params{style} or 'cloud');
- # Needs to update whenever a page is added or removed, so
- # register a dependency.
- add_depends($params{page}, $params{pages});
- add_depends($params{page}, $params{among}) if exists $params{among};
+ # Needs to update whenever a page is added or removed.
+ add_depends($params{page}, $params{pages}, exists => 1);
+ # 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);
my %counts;
my $max = 0;
- foreach my $page (pagespec_match_list([keys %links],
+ foreach my $page (pagespec_match_list([keys %pagesources],
$params{pages}, location => $params{page})) {
use IkiWiki::Render;
diff --git a/IkiWiki/Plugin/postsparkline.pm b/IkiWiki/Plugin/postsparkline.pm
index d2e5c2378..3205958d4 100644
--- a/IkiWiki/Plugin/postsparkline.pm
+++ b/IkiWiki/Plugin/postsparkline.pm
@@ -48,7 +48,7 @@ sub preprocess (@) {
error gettext("unknown formula");
}
- add_depends($params{page}, $params{pages});
+ add_depends($params{page}, $params{pages}, presence => 1);
my @list=sort { $params{timehash}->{$b} <=> $params{timehash}->{$a} }
pagespec_match_list(
diff --git a/IkiWiki/Plugin/progress.pm b/IkiWiki/Plugin/progress.pm
index 76d994acc..26c537a84 100644
--- a/IkiWiki/Plugin/progress.pm
+++ b/IkiWiki/Plugin/progress.pm
@@ -36,8 +36,8 @@ sub preprocess (@) {
$fill.="%";
}
elsif (defined $params{totalpages} and defined $params{donepages}) {
- add_depends($params{page}, $params{totalpages});
- add_depends($params{page}, $params{donepages});
+ add_depends($params{page}, $params{totalpages}, presence => 1);
+ add_depends($params{page}, $params{donepages}, presence => 1);
my @pages=keys %pagesources;
my $totalcount=0;