lib/padrino-helpers/format_helpers.rb in padrino-helpers-0.10.5 vs lib/padrino-helpers/format_helpers.rb in padrino-helpers-0.10.6.a

- old
+ new

@@ -79,14 +79,14 @@ # simple_format("hello\nworld", :tag => :div, :class => :foo) # => "<div class="foo">hello<br/>world</div>" # # @api public def simple_format(text, options={}) t = options.delete(:tag) || :p - start_tag = tag(t, options.merge(:open => true)) + start_tag = tag(t, options) text = text.to_s.dup text.gsub!(/\r\n?/, "\n") # \r\n and \r -> \n text.gsub!(/\n\n+/, "</#{t}>\n\n#{start_tag}") # 2+ newline -> paragraph - text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br + text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br>') # 1 newline -> br text.insert 0, start_tag text << "</#{t}>" end ##