diff options
Diffstat (limited to 'actionmailer/lib/action_mailer/mail_helper.rb')
-rw-r--r-- | actionmailer/lib/action_mailer/mail_helper.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb index 6f22adc479..72314d81ad 100644 --- a/actionmailer/lib/action_mailer/mail_helper.rb +++ b/actionmailer/lib/action_mailer/mail_helper.rb @@ -3,9 +3,9 @@ module ActionMailer # Uses Text::Format to take the text and format it, indented two spaces for # each line, and wrapped at 72 columns. def block_format(text) - formatted = text.split(/\n\r\n/).collect { |paragraph| + formatted = text.split(/\n\r?\n/).collect { |paragraph| format_paragraph(paragraph) - }.join("\n") + }.join("\n\n") # Make list points stand on their own line formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" } @@ -41,7 +41,7 @@ module ActionMailer sentences = [[]] text.split.each do |word| - if (sentences.last + [word]).join(' ').length > len + if sentences.first.present? && (sentences.last + [word]).join(' ').length > len sentences << [word] else sentences.last << word |