diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py index bbe9bebac..be6d2c411 100644 --- a/gramps/plugins/webreport/narrativeweb.py +++ b/gramps/plugins/webreport/narrativeweb.py @@ -3535,7 +3535,8 @@ class PlacePages(BasePage): head += jsc # Google adds Latitude/ Longitude to its maps... - jsc += google_jsc % (latitude, longitude, placetitle) + jsc += google_jsc % (latitude, longitude, + placetitle.replace("'", "\\'")) else: # OpenStreetMap (OSM) adds Longitude/ Latitude to its maps, @@ -5503,7 +5504,7 @@ class PersonPages(BasePage): individualdetail += self.display_ind_associations(assocs) # for use in family map pages... - if len(place_lat_long): + if len(place_lat_long) > 0: if self.report.options["familymappages"]: # save of, string_io and cur_fname before creating a new page sof = of @@ -5638,13 +5639,17 @@ class PersonPages(BasePage): # are we creating Drop Markers or Markers? elif self.googleopts in ["Drop", "Markers"]: tracelife += """ - ['%s', %s, %s, %d],""" % (placetitle, latitude, longitude, seq_) + ['%s', %s, %s, %d],""" % (placetitle.replace("'", "\\'"), latitude, longitude, seq_) # are we using OpenStreetMap? else: tracelife += """ [%s, %s],""" % (longitude, latitude) seq_ += 1 + # FIXME: The last element in the place_lat_long list is treated + # specially, and the code above is apparently repeated so as to + # avoid a comma at the end, and get the right closing. This is very + # ugly. latitude, longitude, placetitle, handle ,date, etype = place_lat_long[-1] # are we using Google? @@ -5660,7 +5665,7 @@ class PersonPages(BasePage): elif self.googleopts in ["Drop", "Markers"]: tracelife += """ ['%s', %s, %s, %d] - ];""" % (placetitle, latitude, longitude, seq_) + ];""" % (placetitle.replace("'", "\\'"), latitude, longitude, seq_) # are we using OpenStreetMap? elif self.mapservice == "OpenStreetMap": @@ -5699,11 +5704,25 @@ class PersonPages(BasePage): # are we using Google? if self.mapservice == "Google": - jsc += google_jsc % (latitude, longitude, placetitle) + # FIXME: Horrible hack, because when there is only a + # single marker, the javascript for place is used, + # which has a 'place_canvas' division, instead of a + # 'map_canvas' division. + jsc += google_jsc.replace("place_canvas", + "map_canvas") % \ + (latitude, longitude, + placetitle.replace("'", "\\'")) # we are using OpenStreetMap? else: - jsc += openstreetmap_jsc % (xml_lang()[3:5].lower(), longitude, latitude) + # FIXME: Horrible hack, because when there is only a + # single marker, the javascript for place is used, + # which has a 'place_canvas' division, instead of a + # 'map_canvas' division. + jsc += openstreetmap_jsc.replace("place_canvas", + "map_canvas") % \ + (xml_lang()[3:5].lower(), + longitude, latitude) # there is more than one marker... else: