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;
}
}
- my $dest=$params{destpage}."/linkmap.png";
+ my $dest=$params{page}."/linkmap.png";
# Use ikiwiki's function to create the file, this makes sure needed
# subdirs are there and does some sanity checking.
- will_render($params{destpage}, $dest);
+ will_render($params{page}, $dest);
writefile($dest, $config{destdir}, "");
# Run dot to create the graphic and get the map data.
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;
} #}}}