From 47bf19c8485ecead7280019c4815a2ed4f2161d5 Mon Sep 17 00:00:00 2001 From: rohit Date: Tue, 8 Jun 2010 16:52:48 +0530 Subject: Made markdown honor :safe option and handle safe input. Also added tests for markdown. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [#4794 state:resolved] Signed-off-by: José Valim --- actionpack/lib/action_view/helpers/text_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view/helpers/text_helper.rb') 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")') # # => '

The ROR logo

' - 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 -- cgit v1.2.3