Sha256: 6113f4fe02ff9bc2dc435fd16bf5f6881a3a40ab3562ff861f891c31c06c819f

Contents?: true

Size: 517 Bytes

Versions: 14

Compression:

Stored size: 517 Bytes

Contents

require 'action_mailer/vendor/text/format'

module MailHelper#:nodoc:
  def block_format(text)
    formatted = text.split(/\n\r\n/).collect { |paragraph| 
      Text::Format.new(
        :columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph
      ).format
    }.join("\n")
    
    # Make list points stand on their own line
    formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| "  #{$1} #{$2.strip}\n" }
    formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| "  #{$1} #{$2.strip}\n" }

    formatted
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
devise_sociable-0.1.0 vendor/bundle/gems/actionmailer-0.6.1/lib/action_mailer/mail_helper.rb
actionmailer-0.6.0 lib/action_mailer/mail_helper.rb
actionmailer-0.6.1 lib/action_mailer/mail_helper.rb
actionmailer-0.5.0 lib/action_mailer/mail_helper.rb
actionmailer-0.4.0 lib/action_mailer/mail_helper.rb
actionmailer-0.7.0 lib/action_mailer/mail_helper.rb
actionmailer-0.3.0 lib/action_mailer/mail_helper.rb
actionmailer-0.7.1 lib/action_mailer/mail_helper.rb
actionmailer-0.9.1 lib/action_mailer/mail_helper.rb
actionmailer-1.0.0 lib/action_mailer/mail_helper.rb
actionmailer-0.8.0 lib/action_mailer/mail_helper.rb
actionmailer-0.8.1 lib/action_mailer/mail_helper.rb
actionmailer-0.9.0 lib/action_mailer/mail_helper.rb
actionmailer-1.0.1 lib/action_mailer/mail_helper.rb