Permalink
Browse files

Fixed that textilize and markdown would instantiate their engines eve…

…n on empty strings. This also fixes #333 [Ulysses]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@224 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent b586c7a commit c8b24915c6f8a8c61087cac6c3f605c254b0e105 @dhh dhh committed Dec 19, 2004
Showing with 4 additions and 2 deletions.
  1. +2 −0 actionpack/CHANGELOG
  2. +2 −2 actionpack/lib/action_view/helpers/text_helper.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that textilize and markdown would instantiate their engines even on empty strings. This also fixes #333 [Ulysses]
+
* Added use of *_before_type_cast for all input and text fields. This is helpful for getting "100,000" back on a integer-based
validation where the value would normally be "100".
@@ -69,7 +69,7 @@ def pluralize(count, singular, plural = nil)
# 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 @@ def textilize_without_paragraph(text)
# 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

0 comments on commit c8b2491

Please sign in to comment.