aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhellekin <how@cepheide.org>2024-03-17 12:03:06 +0100
committerhellekin <how@cepheide.org>2024-03-17 12:03:06 +0100
commit2b9fbf4cf5534defb6b0890269f4c33ab9ce9336 (patch)
tree3a789e771d5bacab2e80671451684e0ab6a68e33
parent87751ff172c110b18616d56ae9808979ef8f9b08 (diff)
downloaddiscourse-umap-2b9fbf4cf5534defb6b0890269f4c33ab9ce9336.tar.gz
Fix umap URL and REGEX
-rw-r--r--plugin.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugin.rb b/plugin.rb
index 57c9270..3deae46 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -9,14 +9,14 @@ class Onebox::Engine::OpenStreetMapOnebox
@@width = 425
@@height = 350
@@tile_size = 256
- @@REGEX = /^https?:\/\/umap\.openstreetmap\.fr/.*#map=([\d\.]+)\/([-\d\.]+)\/([-\d\.]+)/
+ @@REGEX = /^https?:\/\/umap\.openstreetmap\.fr\/fr\/map\/(.*)#([\d\.]+)\/([-\d\.]+)\/([-\d\.]+)/
# enable oneboxing permalinks (http://wiki.openstreetmap.org/wiki/Permalink) into iframes
matches_regexp(@@REGEX)
def to_html
- zoom, lat, lon = @url.match(@@REGEX).captures
- iframe_url = "//umap.openstreetmap.fr/fr/map?bbox=#{get_bbox(lat.to_f, lon.to_f, zoom.to_i)}"
+ map_name, zoom, lat, lon = @url.match(@@REGEX).captures
+ iframe_url = "//umap.openstreetmap.fr/fr/map/#{map_name}?bbox=#{get_bbox(lat.to_f, lon.to_f, zoom.to_i)}"
if marker = @url.match(/mlat=([-\d\.]+).+mlon=([-\d\.]+)/)
mlat, mlon = marker.captures