X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/9747c47670064f206189eb3c36a8e7fcfe08e172..cedf2c0af568d801fe2cf1917ac0202ce64f838b:/IkiWiki/Plugin/linkmap.pm diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm index 28acbda32..ac26e072e 100644 --- a/IkiWiki/Plugin/linkmap.pm +++ b/IkiWiki/Plugin/linkmap.pm @@ -9,7 +9,6 @@ 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 () { @@ -17,38 +16,18 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } my $mapnum=0; -my %maps; sub preprocess (@) { my %params=@_; $params{pages}="*" unless defined $params{pages}; - # Can't just return the linkmap here, since the htmlscrubber - # scrubs out all tags (with good reason!) - # Instead, insert a placeholder tag, which will be expanded during - # formatting. $mapnum++; - $maps{$mapnum}=\%params; - return "
"; -} - -sub format (@) { - my %params=@_; - - $params{content}=~s/
<\/div>/genmap($1)/eg; - - return $params{content}; -} - -sub genmap ($) { - my $mapnum=shift; - return "" unless exists $maps{$mapnum}; - my %params=%{$maps{$mapnum}}; my $connected=IkiWiki::yesno($params{connected}); # Get all the items to map. @@ -102,10 +81,10 @@ sub genmap ($) { close OUT || error gettext("failed to run dot"); local $/=undef; - my $ret="\n". - . - ""; + my $ret="\"".gettext("linkmap").\n". + ; close IN || error gettext("failed to run dot"); waitpid $pid, 0;