mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #1542 from cmeiklejohn/dont_gsub_on_safebuffer
Don't operate on the safebuffer, operate on a string and convert.
This commit is contained in:
commit
185235333c
1 changed files with 2 additions and 1 deletions
|
@ -258,11 +258,12 @@ module ActionView
|
|||
text = ''.html_safe 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.html_safe.safe_concat("</p>")
|
||||
text = ActiveSupport::SafeBuffer.new(text).safe_concat("</p>")
|
||||
end
|
||||
|
||||
# Creates a Cycle object whose _to_s_ method cycles through elements of an
|
||||
|
|
Loading…
Reference in a new issue