X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/ed54379218d21b9bd52933903e8cb504a15dfe7e..28579180e55dc671bc646f58a3d0d56630922255:/app/helpers/application_helper.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e285215b8..b256dac4c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,7 +2,7 @@ module ApplicationHelper require 'rexml/document' def sanitize(text) - Sanitize.clean(text, Sanitize::Config::OSM) + Sanitize.clean(text, Sanitize::Config::OSM).html_safe end def htmlize(text) @@ -10,11 +10,15 @@ module ApplicationHelper end def linkify(text) - return auto_link(text, :link => :urls, :html => { :rel => "nofollow" }) + if text.html_safe? + Rinku.auto_link(text, :urls, tag_options(:rel => "nofollow")).html_safe + else + Rinku.auto_link(text, :urls, tag_options(:rel => "nofollow")) + end end def html_escape_unicode(text) - chars = ActiveSupport::Multibyte::Chars.u_unpack(text).map do |c| + chars = ActiveSupport::Multibyte::Unicode.u_unpack(text).map do |c| c < 127 ? c.chr : "&##{c.to_s};" end