Platinum Partner

Inserts HTML Line Breaks Before All Newlines In A String


class String
  def nl2br!
    self.gsub("\n\r","
").gsub("\r", "").gsub("\n", "
") end end
Example: text 'line_1 line_2'.nl2br! Result in HTML: line_1
line_2
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}