Permalink
Browse files

Fix google_map for all countries

  • Loading branch information...
1 parent 74652f0 commit 7f6fc7e52f1d6cbf134475b34c843d0f60d6a7ce @RubyBB RubyBB committed Mar 8, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/auto_html/filters/google_map.rb
View
4 lib/auto_html/filters/google_map.rb
@@ -1,13 +1,13 @@
# encoding: UTF-8
AutoHtml.add_filter(:google_map).with(:width => 420, :height => 315, :style => "color:#000;text-align:left", :link_text => "View Larger Map") do |text, options|
- regex = /(https?):\/\/maps\.google\.co(.*)\/maps\?(.*)/
+ regex = /(https?):\/\/maps\.google\.([a-z\.]+)\/maps\?(.*)/
text.gsub(regex) do
domain_country = $2
map_query = $3
width = options[:width]
height = options[:height]
style = options[:style]
link_text = options[:link_text]
- %{<iframe width="#{width}" height="#{height}" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="//maps.google.co#{domain_country}/maps?f=q&amp;source=s_q&amp;#{map_query}&amp;output=embed"></iframe><br /><small><a href="//maps.google.co#{domain_country}/maps?f=q&amp;source=embed&amp;#{map_query}" style="#{style}">#{link_text}</a></small>}
+ %{<iframe width="#{width}" height="#{height}" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="//maps.google.#{domain_country}/maps?f=q&amp;source=s_q&amp;#{map_query}&amp;output=embed"></iframe><br /><small><a href="//maps.google.#{domain_country}/maps?f=q&amp;source=embed&amp;#{map_query}" style="#{style}">#{link_text}</a></small>}
end
end

0 comments on commit 7f6fc7e

Please sign in to comment.