Skip to content

Commit

Permalink
Use html_safe
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Jun 16, 2011
1 parent f2c0fb3 commit eedbe1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_view/helpers/text_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,15 @@ def word_wrap(text, *args)
# simple_format("<span>I'm allowed!</span> It's true.", {}, :sanitize => false)
# # => "<p><span>I'm allowed!</span> It's true.</p>"
def simple_format(text, html_options={}, options={})
text = ''.html_safe if text.nil?
text = '' if text.nil?
start_tag = tag('p', html_options, true)
text = sanitize(text) unless options[:sanitize] == false
text = text.to_str
text.gsub!(/\r\n?/, "\n") # \r\n and \r -> \n
text.gsub!(/\n\n+/, "</p>\n\n#{start_tag}") # 2+ newline -> paragraph
text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
text.insert 0, start_tag
text = ActiveSupport::SafeBuffer.new(text).safe_concat("</p>")
text.html_safe.safe_concat("</p>")
end

# Creates a Cycle object whose _to_s_ method cycles through elements of an
Expand Down

0 comments on commit eedbe1c

Please sign in to comment.