From: Joey Hess Date: Sun, 10 Jan 2010 04:10:26 +0000 (-0500) Subject: linkmap: Simplify and improve browser compatability by using an img, not object tag. X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/commitdiff_plain/9dc5685de44760d2c06a0376c97eb699de2f2964 linkmap: Simplify and improve browser compatability by using an img, not object tag. I noticed that chromium was not hyperlinking the areas in the object-based linkmap, while img works ok. Dunno why, but img based is nicer anyway since it is allowed right through the htmlscrubber with no workarounds. --- diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm index 28acbda32..68eb6c8c6 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 () { @@ -21,34 +20,13 @@ sub getsetup () { } 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 +80,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; diff --git a/debian/changelog b/debian/changelog index bd638b36f..55213df9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ ikiwiki (3.20100104) UNRELEASED; urgency=low * img: Support alignment of images with captions. (Giuseppe Bilotta) * websetup: Fix utf-8 problems. * websetup: Fix bug in array change detection. + * linkmap: Simplify and improve browser compatability by using an img, + not object tag. -- Joey Hess Mon, 04 Jan 2010 12:53:24 -0500