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.
sub import {
hook(type => "getsetup", id => "linkmap", call => \&getsetup);
hook(type => "preprocess", id => "linkmap", call => \&preprocess);
sub import {
hook(type => "getsetup", id => "linkmap", call => \&getsetup);
hook(type => "preprocess", id => "linkmap", call => \&preprocess);
- hook(type => "format", id => "linkmap", call => \&format);
sub preprocess (@) {
my %params=@_;
$params{pages}="*" unless defined $params{pages};
sub preprocess (@) {
my %params=@_;
$params{pages}="*" unless defined $params{pages};
- # Can't just return the linkmap here, since the htmlscrubber
- # scrubs out all <object> tags (with good reason!)
- # Instead, insert a placeholder tag, which will be expanded during
- # formatting.
- $maps{$mapnum}=\%params;
- return "<div class=\"linkmap$mapnum\"></div>";
-}
-
-sub format (@) {
- my %params=@_;
-
- $params{content}=~s/<div class=\"linkmap(\d+)"><\/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.
my $connected=IkiWiki::yesno($params{connected});
# Get all the items to map.
close OUT || error gettext("failed to run dot");
local $/=undef;
close OUT || error gettext("failed to run dot");
local $/=undef;
- my $ret="<object data=\"".urlto($dest, $params{destpage}).
- "\" type=\"image/png\" usemap=\"#linkmap$mapnum\">\n".
- <IN>.
- "</object>";
+ my $ret="<img src=\"".urlto($dest, $params{destpage}).
+ "\" alt=\"".gettext("linkmap").
+ "\" usemap=\"#linkmap$mapnum\" />\n".
+ <IN>;
close IN || error gettext("failed to run dot");
waitpid $pid, 0;
close IN || error gettext("failed to run dot");
waitpid $pid, 0;
* img: Support alignment of images with captions. (Giuseppe Bilotta)
* websetup: Fix utf-8 problems.
* websetup: Fix bug in array change detection.
* 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 <joeyh@debian.org> Mon, 04 Jan 2010 12:53:24 -0500
-- Joey Hess <joeyh@debian.org> Mon, 04 Jan 2010 12:53:24 -0500