Skip to content

Instantly share code, notes, and snippets.

@elight
Forked from samanthachui/application_helper.rb
Created July 8, 2011 23:41

Revisions

  1. Evan David Light revised this gist Jul 9, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion application_helper.rb
    Original file line number Diff line number Diff line change
    @@ -6,5 +6,5 @@ def simpler_format(text, html_options={}, options={})
    text.gsub!(/\n\n+/, "<br /><br />")
    text.gsub!(/\n/, "<br />")
    text.concat!("<br />")
    text = ActiveSupport::SafeBuffer.new(text).html_safe
    text.html_safe
    end
  2. Evan David Light revised this gist Jul 9, 2011. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions application_helper.rb
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@
    def simpler_format(text, html_options={}, options={})
    text = text ? String.new(text) : ''
    text = sanitize(text) unless options[:sanitize] == false
    text.gsub(/\r\n?/, "\n").
    gsub!(/\n\n+/, "<br /><br />").
    gsub!(/\n/, "<br />").
    concat!("<br />").
    html_safe
    text = text.gsub(/\r\n?/, "\n")
    text.gsub!(/\n\n+/, "<br /><br />")
    text.gsub!(/\n/, "<br />")
    text.concat!("<br />")
    text = ActiveSupport::SafeBuffer.new(text).html_safe
    end
  3. Evan David Light revised this gist Jul 9, 2011. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions application_helper.rb
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,9 @@
    def simpler_format(text, html_options={}, options={})
    text = text ? String.new(text) : ''
    text = sanitize(text) unless options[:sanitize] == false
    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
    text.gsub(/\r\n?/, "\n").
    gsub!(/\n\n+/, "<br /><br />").
    gsub!(/\n/, "<br />").
    concat!("<br />").
    html_safe
    end
  4. Evan David Light revised this gist Jul 9, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion application_helper.rb
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    def simpler_format(text, html_options={}, options={})
    text = text ? String.new(text) : ''
    text = sanitize(text) unless options[:sanitize] == false
    text.gsub!(/\r\n?/, "\n")
    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
  5. Evan David Light revised this gist Jul 8, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion application_helper.rb
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Copy/paste of simple_format from Rails but with <p> removed.
    def simpler_format(text, html_options={}, options={})
    text = '' if text.nil?
    text = text ? String.new(text) : ''
    text = sanitize(text) unless options[:sanitize] == false
    text.gsub!(/\r\n?/, "\n")
    text.gsub!(/\n\n+/, "<br /><br />")
  6. Evan David Light revised this gist Jul 8, 2011. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions application_helper.rb
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,7 @@
    # 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 = '' 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 />")
  7. samanthachui renamed this gist Jul 8, 2011. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion gistfile1.txt → application_helper.rb
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    # Copy/paste of simple_format from Rails but with <p> removed.
    def simpler_format(text, html_options={}, options={})
    text = ''.html_safe if text.nil?
  8. samanthachui created this gist Jul 8, 2011.
    11 changes: 11 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@

    # 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