Sha256: 7d9bd274330c0b4a02f74e8162257e6bdaf98743c8386171165f072b31da08fc
Contents?: true
Size: 322 Bytes
Versions: 6
Compression:
Stored size: 322 Bytes
Contents
AutoHtml.add_filter(:simple_format) do |text| start_tag = '<p>' 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 << "</p>" end
Version data entries
6 entries across 6 versions & 2 rubygems