I’m using rails and need to show text, having 3 or more newline characters in a row.
I found simple_format method, but it works with 2,3,4,… symbols identically
Two or more consecutive newlines(\n\n) are considered as a paragraph and wrapped in < p > tags.
For example, my text is
1.9.3p0 :015 > Article.last.text
=> "1\n\n2\n\n\n\n33"
when i do <%= simple_format Article.last.text.html_safe %> it generates me this view:
<p>1</p>
<p>2</p>
# but i need <br/> or smth else there
<p>3</p>
Other solutions are welcome, thanks.
I might still be missing something, but why not just use
string.gsub(a, b):Surely you can also pass the previous line to
simple_formatto have the line wrapped into a<p>tag.