config/initializers/core_extensions_2.rb
# this method is only acting on text which does not current contain <br> or <p> tag.
# We used to not have a WYSIWYG editor for text and newlines were the way to break text into paragraphs.
# Some informed users would still put in HTML tags, and if they did then they were responsible for their
# own linebreaking. So this will prevent WYSIWYG text (which always has at least one <p>) and pre-tagged
# text from getting extra linebreaks. The 'wrap_in_paragraph' parameter will wrap this legacy text into
# a <p> tag so that the styles on the DataObject page are applied consistently
this method is only acting on text which does not current contain  or  tag.
We used to not have a WYSIWYG editor for text and newlines were the way to break text into paragraphs.
Some informed users would still put in HTML tags, and if they did then they were responsible for their
own linebreaking. So this will prevent WYSIWYG text (which always has at least one ) and pre-tagged
text from getting extra linebreaks. The 'wrap_in_paragraph' parameter will wrap this legacy text into
a  tag so that the styles on the DataObject page are applied consistently
this method is only acting on text which does not current contain or tag . We used to not have a WYSIWYG editor for text and newlines were the way to break text into paragraphs . Some informed users would still put in HTML tags and if they did then they were responsible for their own linebreaking . So this will prevent WYSIWYG text ( which always has at least one ) and pre - tagged text from getting extra linebreaks . The ' wrap_in_paragraph ' parameter will wrap this legacy text into a tag so that the styles on the DataObject page are applied consistently
def fix_old_user_added_text_linebreaks(options={})
    line_breaks = /[\r\n]/
    unless self.match(/<(br|p)\s*[\/]?\s*>/)  
      text = self.gsub(line_breaks, '<br/>')
      text.gsub!(/(<br\/>){2,}/, "<br/><br/>")
      if options[:wrap_in_paragraph]
        return "<p>#{text}</p>"
      else
        return text
      end
    end
    return self
  end
def fix_old_user_added_text_linebreaks ( options = { } ) line_breaks = / [ \r \n ] / unless self . match ( / <(br|p) \s *[ \/ ]? \s *> / ) text = self . gsub ( line_breaks , '<br/>' ) text . gsub! ( / (<br \/ >){2,} / , "<br/><br/>" ) if options [ :wrap_in_paragraph ] return "<p>#{text}</p>" else return text end end return self end
this method is only acting on text which does not current contain <br> or <p> tag.
this method is only acting on text which does not current contain <br > or <p > tag .
# if there is a br or p tag, then don't do the conversion
options
<not_specific>