From: Joey Hess <joey@gnu.kitenet.net>
Date: Fri, 9 Oct 2009 16:35:41 +0000 (-0400)
Subject: linkmap: Use new pagespec_match_list
X-Git-Tag: 3.20091017~27^2~49
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/c791f84fb54c723e3bb488a5099e435a64d1c8b0?ds=inline

linkmap: Use new pagespec_match_list
---

diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm
index 28e4cfa13..9540bd112 100644
--- a/IkiWiki/Plugin/linkmap.pm
+++ b/IkiWiki/Plugin/linkmap.pm
@@ -28,10 +28,6 @@ sub preprocess (@) {
 
 	$params{pages}="*" unless defined $params{pages};
 	
-	# Needs to update whenever a relevant page is added, or removed, or
-	# its links change.
-	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!)
 	# Instead, insert a placeholder tag, which will be expanded during
@@ -55,12 +51,11 @@ sub genmap ($) {
 	my %params=%{$maps{$mapnum}};
 
 	# Get all the items to map.
-	my %mapitems = ();
-	foreach my $item (keys %pagesources) {
-		if (pagespec_match($item, $params{pages}, location => $params{page})) {
-			$mapitems{$item}=urlto($item, $params{destpage});
-		}
-	}
+	my %mapitems = map { $_ => urlto($_, $params{destpage}) }
+		pagespec_match_list($params{page}, $params{pages},
+			# update when a page is added or removed, or its
+			# links change
+			deptype => deptype("presence", "links"));
 
 	my $dest=$params{page}."/linkmap.png";