aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorrohit <rohit.arondekar@gmail.com>2010-06-08 16:52:48 +0530
committerJosé Valim <jose.valim@gmail.com>2010-06-08 17:00:11 +0200
commit47bf19c8485ecead7280019c4815a2ed4f2161d5 (patch)
tree4856bd09630c97ee5e8cee4defeb0f2ceb7445bd /actionpack/lib/action_view
parent9d33c2ab6f29e7be32f3b3607f89f2fbc888853b (diff)
downloadrails-47bf19c8485ecead7280019c4815a2ed4f2161d5.tar.gz
rails-47bf19c8485ecead7280019c4815a2ed4f2161d5.tar.bz2
rails-47bf19c8485ecead7280019c4815a2ed4f2161d5.zip
Made markdown honor :safe option and handle safe input. Also added tests for markdown.
[#4794 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_view')
-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 19f55143bf..8f63845d49 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -298,8 +298,8 @@ module ActionView
#
# markdown('![The ROR logo](http://rubyonrails.com/images/rails.png "Ruby on Rails")')
# # => '<p><img src="http://rubyonrails.com/images/rails.png" alt="The ROR logo" title="Ruby on Rails" /></p>'
- def markdown(text, options = {})
- text = sanitize(text) unless options[:safe]
+ def markdown(text, *options)
+ text = sanitize(text) unless text.html_safe? || options.delete(:safe)
(text.blank? ? "" : BlueCloth.new(text).to_html).html_safe
end