use warnings;
use strict;
-use IkiWiki;
+use IkiWiki 2.00;
use IPC::Open2;
sub import { #{{{
+ hook(type => "getsetup", id => "linkmap", call => \&getsetup);
hook(type => "preprocess", id => "linkmap", call => \&preprocess);
hook(type => "format", id => "linkmap", call => \&format);
} # }}}
+sub getsetup () { #{{{
+ return
+ plugin => {
+ safe => 1,
+ rebuild => undef,
+ },
+} #}}}
+
my $mapnum=0;
my %maps;
# Get all the items to map.
my %mapitems = ();
foreach my $item (keys %links) {
- if (pagespec_match($item, $params{pages}, $params{page})) {
+ if (pagespec_match($item, $params{pages}, location => $params{page})) {
$mapitems{$item}=urlto($item, $params{destpage});
}
}
close OUT;
local $/=undef;
- my $ret="<object data=\"".urlto($dest, $params{page}).
+ my $ret="<object data=\"".urlto($dest, $params{destpage}).
"\" type=\"image/png\" usemap=\"#linkmap$mapnum\">\n".
<IN>.
"</object>";
waitpid $pid, 0;
$SIG{PIPE}="DEFAULT";
- if ($sigpipe) {
- return "[[linkmap ".gettext("failed to run dot")."]]";
- }
+ error gettext("failed to run dot") if $sigpipe;
return $ret;
} #}}}