Fix incorrect URL pointing to the generated waypoint files by calling will_render...
authorPhilippe Gauthier <philippe.gauthier@deuxpi.ca>
Thu, 2 Aug 2012 20:29:32 +0000 (20:29 +0000)
committerJoey Hess <joey@kitenet.net>
Mon, 6 Aug 2012 01:58:32 +0000 (21:58 -0400)
Fixes
http://ikiwiki.info/bugs/osm_linkto__40____41___usage_breaks_map_rendering/
(cherry picked from commit 691312225789ff6cd5e3fcc4979c076791d67452)

IkiWiki/Plugin/osm.pm

index c9c5646c475801c125ac984a60a59a8a9b1f1cf3..e96a1283752ff5dfe721d73fd09f22746831413d 100644 (file)
@@ -62,6 +62,25 @@ sub getsetup () {
                },
 }
 
+sub register_rendered_files {
+       my $map = shift;
+       my $page = shift;
+       my $dest = shift;
+
+       if ($page eq $dest) {
+               my %formats = get_formats();
+               if ($formats{'GeoJSON'}) {
+                       will_render($page, "$map/pois.json");
+               }
+               if ($formats{'CSV'}) {
+                       will_render($page, "$map/pois.txt");
+               }
+               if ($formats{'KML'}) {
+                       will_render($page, "$map/pois.kml");
+               }
+       }
+}
+
 sub preprocess {
        my %params=@_;
        my $page = $params{page};
@@ -98,6 +117,8 @@ sub preprocess {
                );
        }
 
+       register_rendered_files($map, $page, $dest);
+
        $pagestate{$page}{'osm'}{$map}{'displays'}{$name} = {
                height => $height,
                width => $width,
@@ -150,18 +171,7 @@ sub process_waypoint {
        }
        $icon = urlto($icon, $dest, 1);
        $tag = '' unless $tag;
-       if ($page eq $dest) {
-               my %formats = get_formats();
-               if ($formats{'GeoJSON'}) {
-                       will_render($page, "$map/pois.json");
-               }
-               if ($formats{'CSV'}) {
-                       will_render($page, "$map/pois.txt");
-               }
-               if ($formats{'KML'}) {
-                       will_render($page, "$map/pois.kml");
-               }
-       }
+       register_rendered_files($map, $page, $dest);
        $pagestate{$page}{'osm'}{$map}{'waypoints'}{$name} = {
                page => $page,
                desc => $desc,