Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in latest changes from rails/master
- Loading branch information
Showing
4 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module ActionMailer | ||
module MailHelper | ||
# 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| | ||
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 | ||
end |
This file contains 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