From 7dbb2b6f83c5a1a5f4ef0a97fee5322957977306 Mon Sep 17 00:00:00 2001 From: rizwanreza Date: Sun, 9 Aug 2009 05:55:25 +0300 Subject: Support passing Redcloth options via textilize helper [#2973 state:resolved] Signed-off-by: Pratik Naik --- actionpack/lib/action_view/helpers/text_helper.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 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 34ef742a6e..1d92bcb763 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -241,12 +241,20 @@ 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) textilized.to_html end end -- cgit v1.2.3