]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/linkmap.pm
Merge commit 'upstream/master' into pub/master
[git.ikiwiki.info.git] / IkiWiki / Plugin / linkmap.pm
index 62984d9b88b1082c8d40cca133ed8ae5174fb26f..81ee665c8c5513cc5a1acdcf16a93028ad9bb141 100644 (file)
@@ -7,10 +7,19 @@ use IkiWiki 2.00;
 use IPC::Open2;
 
 sub import { #{{{
 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);
 } # }}}
 
        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 $mapnum=0;
 my %maps;
 
@@ -86,7 +95,7 @@ sub genmap ($) { #{{{
        close OUT;
 
        local $/=undef;
        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>";
               "\" type=\"image/png\" usemap=\"#linkmap$mapnum\">\n".
                <IN>.
                "</object>";
@@ -94,9 +103,7 @@ sub genmap ($) { #{{{
        
        waitpid $pid, 0;
        $SIG{PIPE}="DEFAULT";
        
        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;
 } #}}}
 
        return $ret;
 } #}}}