Created
July 8, 2011 23:37
-
-
Save samanthachui/1073083 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy/paste of simple_format from Rails but with <p> removed. | |
def simpler_format(text, html_options={}, options={}) | |
text = ''.html_safe if text.nil? | |
text = sanitize(text) unless options[:sanitize] == false | |
text = String.new(text) | |
text.gsub!(/\r\n?/, "\n") | |
text.gsub!(/\n\n+/, "<br /><br />") | |
text.gsub!(/\n/, "<br />") | |
text = ActiveSupport::SafeBuffer.new(text).safe_concat("<br />").html_safe | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment