This project is archived and is in readonly mode.
Add options passing to textilze helper
Reported by Magnus Bergmark | July 29th, 2009 @ 02:06 PM
When rendering textile inside a view using the textilize helper
method, it is impossible to pass options to the renderer, which
could be very useful if you want to filter HTML or perhaps just
want to use lite_mode
.
This proposed patch gives the ability to pass options by
supplying them after the string like this
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>"
Comments and changes to this ticket
-
Matt Jones July 30th, 2009 @ 02:54 AM
The loop over options doesn't make sense - that's nearly the same code that TextileDoc.new executes. Why repeat it?
-
Magnus Bergmark July 30th, 2009 @ 07:54 AM
I agree. It was there in the original code (hardcoded to only
:heard_breaks
, though) so I thought it was necessary for some form of backwards compatibility.I traced back the code and it seems to have appeared 2005 in the SVN repo. A git show on this commit might show people more:
commit 810ebf7c6a2e9d02f76d8727e56c1706cc6ff66e Author: David Heinemeier Hansson <david@loudthinking.com> Date: Sun Oct 2 20:21:43 2005 +0000
Forced newer versions of RedCloth to use hard breaks [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2436 5ecf4fe2-1ee6-0310-87b1-e25e094e27de</code>
I think this is redundant now. Here's a new patch without this loop. Someone more knowledgeable can choose which patch looks better.
-
Rizwan Reza August 9th, 2009 @ 03:15 AM
- Assigned user set to Michael Koziarski
- Tag changed from 2.3.x, feature_request, helper, patch, text_helper to 2.3.x, bugmash, feature_request, helper, patch, text_helper
verified
+1 I have attached an updated patch. There were no test cases in text_helper_test.rb so I added a couple of those.
-
Rizwan Reza August 9th, 2009 @ 03:36 AM
verified
+1 This works on master. I have employed the changes advised by nzkoz.
-
Rizwan Reza August 9th, 2009 @ 03:58 AM
verified
+1 Added one more test for hard_breaks. Refactored.
-
Rizwan Reza August 9th, 2009 @ 04:00 AM
- Tag changed from 2.3.x, bugmash, feature_request, helper, patch, text_helper to 3.0, bugmash, feature_request, helper, patch, text_helper
This is for master branch.
-
Rizwan Reza August 9th, 2009 @ 04:03 PM
verified
By the way, though nzkoz suggests that this should be applied to master.. this passes cleanly on 2-3-stable too.
-
David Trasbo August 9th, 2009 @ 04:18 PM
This patch does not apply to master:
<stdin>:29: trailing whitespace. <stdin>:54: trailing whitespace. <stdin>:58: trailing whitespace. <stdin>:62: trailing whitespace. <stdin>:66: trailing whitespace. error: patch failed: actionpack/lib/action_view/helpers/text_helper.rb:241 error: actionpack/lib/action_view/helpers/text_helper.rb: patch does not apply error: patch failed: actionpack/test/template/text_helper_test.rb:1 error: actionpack/test/template/text_helper_test.rb: patch does not apply
(With --whitespace=fix)
-
Repository August 9th, 2009 @ 04:43 PM
- State changed from new to resolved
(from [7dbb2b6f83c5a1a5f4ef0a97fee5322957977306]) Support passing Redcloth options via textilize helper [#2973 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/7dbb2b6f83c5a1a5f4ef0a97fee532... -
Repository August 9th, 2009 @ 04:43 PM
(from [d1202cfeb2cc7961c93a33ef3f5622d5393186f1]) Support passing Redcloth options via textilize helper [#2973 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/d1202cfeb2cc7961c93a33ef3f5622... -
David Trasbo August 9th, 2009 @ 04:44 PM
verified
Must have been something wrong with my clone. Sorry about that.
-
CancelProfileIsBroken August 9th, 2009 @ 05:13 PM
- Assigned user cleared.
- Tag changed from 3.0, bugmash, feature_request, helper, patch, text_helper to 3.0, feature_request, helper, patch, text_helper
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 2973 Add options passing to textilze helper (from [7dbb2b6f83c5a1a5f4ef0a97fee5322957977306]) Support...
- 2973 Add options passing to textilze helper (from [d1202cfeb2cc7961c93a33ef3f5622d5393186f1]) Support...