module ApplicationHelper
+ require 'rexml/document'
+
def htmlize(text)
- return sanitize(auto_link(simple_format(text), :link => :urls, :html => { :rel => "nofollow" }))
+ return linkify(sanitize(simple_format(text)))
+ end
+
+ def linkify(text)
+ return auto_link(text, :link => :urls, :html => { :rel => "nofollow" })
end
def html_escape_unicode(text)
return js
end
+ def describe_location(lat, lon, zoom, language)
+ zoom = zoom || 14
+ language = language || request.user_preferred_languages.join(',')
+ url = "http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{language}"
+ response = REXML::Document.new(Net::HTTP.get(URI.parse(url)))
+
+ return response.get_text("reversegeocode/result").to_s
+ end
+
private
def javascript_strings_for_key(key)