X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/8125cfa45b38b653266d03e6106a918f64a7d225..afa777c11f0aac947fd04cd03190d18a9de32ffb:/IkiWiki/Plugin/osm.pm diff --git a/IkiWiki/Plugin/osm.pm b/IkiWiki/Plugin/osm.pm index e47e83b07..2b5d0d5f1 100644 --- a/IkiWiki/Plugin/osm.pm +++ b/IkiWiki/Plugin/osm.pm @@ -9,7 +9,7 @@ use warnings; use IkiWiki 3.0; sub import { - add_underlay("javascript"); + add_underlay("osm"); hook(type => "getsetup", id => "osm", call => \&getsetup); hook(type => "format", id => "osm", call => \&format); hook(type => "preprocess", id => "osm", call => \&preprocess); @@ -34,7 +34,7 @@ sub getsetup () { }, osm_default_icon => { type => "string", - example => "img/osm.png", + example => "/ikiwiki/images/osm.png", description => "the icon shon on links and on the main map", safe => 0, rebuild => 1, @@ -137,7 +137,7 @@ sub process_waypoint { my $name = scrub($params{'name'} || $p, $page, $dest); # sanitized here my $desc = scrub($params{'desc'} || '', $page, $dest); # sanitized here my $zoom = scrub($params{'zoom'} // $config{'osm_default_zoom'} // 15, $page, $dest); # sanitized below - my $icon = $config{'osm__default_icon'} || "img/osm.png"; # sanitized: we trust $config + my $icon = $config{'osm__default_icon'} || "/ikiwiki/images/osm.png"; # sanitized: we trust $config my $map = scrub($params{'map'} || 'map', $page, $dest); # sanitized here my $alt = $config{'osm_alt'} ? "alt=\"$config{'osm_alt'}\"" : ''; # sanitized: we trust $config if ($zoom !~ /^\d\d?$/ || $zoom < 2 || $zoom > 18) { @@ -169,7 +169,7 @@ sub process_waypoint { } } } - $icon = "/img/unknown.png" unless $icon; + $icon = "/ikiwiki/images/osm.png" unless $icon; $tag = '' unless $tag; if ($page eq $dest) { if (!defined($config{'osm_format'}) || !$config{'osm_format'}) { @@ -528,7 +528,7 @@ sub include_javascript ($) { } } if ($loader) { - return embed_map_code() . ""; + return embed_map_code($page) . ""; } else { return ''; @@ -552,147 +552,18 @@ sub cgi($) { print ("\r\n"); print ""; print "
"; - print embed_map_code($map); + print embed_map_code(); print ""; print ""; exit 0; } -sub embed_map_code() { - return < - -EOF +sub embed_map_code(;$) { + my $page=shift; + return ''. + ''."\n"; } 1;