##// END OF EJS Templates
Fixes #880: code tags not formatted correctly in the wiki (broken by r1216)....
Jean-Philippe Lang -
r1256:7673d69b96cf
parent child
Show More
@@ -1130,7 +1130,7 class RedCloth < String
1130 end
1130 end
1131 end
1131 end
1132
1132
1133 ALLOWED_TAGS = %w(redpre pre)
1133 ALLOWED_TAGS = %w(redpre pre code)
1134
1134
1135 def escape_html_tags(text)
1135 def escape_html_tags(text)
1136 text.gsub!(%r{<((\/?)(\w+))}) {|m| ALLOWED_TAGS.include?($3) ? "<#{$1}" : "&lt;#{$1}" }
1136 text.gsub!(%r{<((\/?)(\w+))}) {|m| ALLOWED_TAGS.include?($3) ? "<#{$1}" : "&lt;#{$1}" }
@@ -132,6 +132,19 class ApplicationHelperTest < HelperTestCase
132 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
132 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
133 end
133 end
134
134
135 def test_html_tags
136 to_test = {
137 "<div>content</div>" => "<p>&lt;div>content&lt;/div></p>",
138 "<script>some script;</script>" => "<p>&lt;script>some script;&lt;/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>&lt;div&gt;content&lt;/div&gt;</pre>",
143 }
144 to_test.each { |text, result| assert_equal result, textilizable(text) }
145
146 end
147
135 def test_macro_hello_world
148 def test_macro_hello_world
136 text = "{{hello_world}}"
149 text = "{{hello_world}}"
137 assert textilizable(text).match(/Hello world!/)
150 assert textilizable(text).match(/Hello world!/)
General Comments 0
You need to be logged in to leave comments. Login now