@@ -1130,7 +1130,7 class RedCloth < String | |||
|
1130 | 1130 | end |
|
1131 | 1131 | end |
|
1132 | 1132 | |
|
1133 | ALLOWED_TAGS = %w(redpre pre) | |
|
1133 | ALLOWED_TAGS = %w(redpre pre code) | |
|
1134 | 1134 | |
|
1135 | 1135 | def escape_html_tags(text) |
|
1136 | 1136 | text.gsub!(%r{<((\/?)(\w+))}) {|m| ALLOWED_TAGS.include?($3) ? "<#{$1}" : "<#{$1}" } |
@@ -132,6 +132,19 class ApplicationHelperTest < HelperTestCase | |||
|
132 | 132 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
|
133 | 133 | end |
|
134 | 134 | |
|
135 | def test_html_tags | |
|
136 | to_test = { | |
|
137 | "<div>content</div>" => "<p><div>content</div></p>", | |
|
138 | "<script>some script;</script>" => "<p><script>some script;</script></p>", | |
|
139 | # do not escape pre/code tags | |
|
140 | "<pre>\nline 1\nline2</pre>" => "<pre>\nline 1\nline2</pre>", | |
|
141 | "<pre><code>\nline 1\nline2</code></pre>" => "<pre><code>\nline 1\nline2</code></pre>", | |
|
142 | "<pre><div>content</div></pre>" => "<pre><div>content</div></pre>", | |
|
143 | } | |
|
144 | to_test.each { |text, result| assert_equal result, textilizable(text) } | |
|
145 | ||
|
146 | end | |
|
147 | ||
|
135 | 148 | def test_macro_hello_world |
|
136 | 149 | text = "{{hello_world}}" |
|
137 | 150 | assert textilizable(text).match(/Hello world!/) |
General Comments 0
You need to be logged in to leave comments.
Login now