From b7c565057d51a92db7bdc1e516a980bfb27489b2 Mon Sep 17 00:00:00 2001 From: Magnus Bergmark Date: Wed, 29 Jul 2009 14:55:24 +0200 Subject: [PATCH] Added options passing for textilize helper --- actionpack/lib/action_view/helpers/text_helper.rb | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index 8463af9..d8d08b2 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -234,12 +234,21 @@ module ActionView # # textilize("Visit the Rails website "here":http://www.rubyonrails.org/.) # # => "

Visit the Rails website here.

" - def textilize(text) + # + # textilize("This is worded strongly") + # # => "

This is worded strongly

" + # + # textilize("This is worded strongly", :filter_html) + # # => "

This is worded <strong>strongly</strong>

" + def textilize(text, *options) + options ||= [:hard_breaks] if text.blank? "" else - textilized = RedCloth.new(text, [ :hard_breaks ]) - textilized.hard_breaks = true if textilized.respond_to?(:hard_breaks=) + textilized = RedCloth.new(text, options) + options.each do |option| + textilized.send(:"#{option}=", true) if textilized.respond_to?(:"#{option}=") + end textilized.to_html end end -- 1.6.3.1