diff options
author | rizwanreza <rizwanreza@gmail.com> | 2009-08-09 05:55:25 +0300 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-08-09 16:41:09 +0100 |
commit | 7dbb2b6f83c5a1a5f4ef0a97fee5322957977306 (patch) | |
tree | 64343e01585bf82677c9e010db449a9cd772ec21 /actionpack/lib | |
parent | 7d254b5d74144a1e217125e7be21882ce380a3f8 (diff) | |
download | rails-7dbb2b6f83c5a1a5f4ef0a97fee5322957977306.tar.gz rails-7dbb2b6f83c5a1a5f4ef0a97fee5322957977306.tar.bz2 rails-7dbb2b6f83c5a1a5f4ef0a97fee5322957977306.zip |
Support passing Redcloth options via textilize helper [#2973 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/text_helper.rb | 14 |
1 files changed, 11 insertions, 3 deletions
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/.) # # => "<p>Visit the Rails website <a href="http://www.rubyonrails.org/">here</a>.</p>" - def textilize(text) + # + # textilize("This is worded <strong>strongly</strong>") + # # => "<p>This is worded <strong>strongly</strong></p>" + # + # textilize("This is worded <strong>strongly</strong>", :filter_html) + # # => "<p>This is worded <strong>strongly</strong></p>" + # + 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 |