aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/text_helper.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-19 13:33:51 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-19 13:33:51 +0000
commitc8b24915c6f8a8c61087cac6c3f605c254b0e105 (patch)
tree5d3a4d5fe5d6fde57b619f77268d2d1b7788bd3b /actionpack/lib/action_view/helpers/text_helper.rb
parentb586c7a97ab7b2b7bf9fde4710e10ca3343a2e3f (diff)
downloadrails-c8b24915c6f8a8c61087cac6c3f605c254b0e105.tar.gz
rails-c8b24915c6f8a8c61087cac6c3f605c254b0e105.tar.bz2
rails-c8b24915c6f8a8c61087cac6c3f605c254b0e105.zip
Fixed that textilize and markdown would instantiate their engines even on empty strings. This also fixes #333 [Ulysses]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@224 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/text_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index 7e05e468b8..cb5a4578ee 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -69,7 +69,7 @@ module ActionView
# Returns the text with all the Textile codes turned into HTML-tags.
# <i>This method is only available if RedCloth can be required</i>.
def textilize(text)
- RedCloth.new(text).to_html
+ text.empty? ? "" : RedCloth.new(text).to_html
end
# Returns the text with all the Textile codes turned into HTML-tags, but without the regular bounding <p> tag.
@@ -90,7 +90,7 @@ module ActionView
# Returns the text with all the Markdown codes turned into HTML-tags.
# <i>This method is only available if BlueCloth can be required</i>.
def markdown(text)
- BlueCloth.new(text).to_html
+ text.empty? ? "" : BlueCloth.new(text).to_html
end
rescue LoadError
# We can't really help what's not there