##// END OF EJS Templates
Reverts r14812 (#6969)....
Jean-Philippe Lang -
r14481:868d949f47c2
parent child
Show More
@@ -1202,7 +1202,7 class RedCloth3 < String
1202 ALLOWED_TAGS = %w(redpre pre code notextile)
1202 ALLOWED_TAGS = %w(redpre pre code notextile)
1203
1203
1204 def escape_html_tags(text)
1204 def escape_html_tags(text)
1205 text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)?(>?)}) {|m| $2 && ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "&lt;#{$1}#{'&gt;' unless $3.blank?}" }
1205 text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "&lt;#{$1}#{'&gt;' unless $3.blank?}" }
1206 end
1206 end
1207 end
1207 end
1208
1208
@@ -160,19 +160,12 EXPECTED
160 assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
160 assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '')
161 end
161 end
162
162
163 def test_should_escape_unallowed_tags
163 def test_escaping
164 assert_html_output(
164 assert_html_output(
165 'this is a <script>' => 'this is a &lt;script&gt;'
165 'this is a <script>' => 'this is a &lt;script&gt;'
166 )
166 )
167 end
167 end
168
168
169 def test_should_escape_less_than_signs
170 assert_html_output(
171 '<' => '&lt;',
172 '1 < 2' => '1 &lt; 2'
173 )
174 end
175
176 def test_use_of_backslashes_followed_by_numbers_in_headers
169 def test_use_of_backslashes_followed_by_numbers_in_headers
177 assert_html_output({
170 assert_html_output({
178 'h1. 2009\02\09' => '<h1>2009\02\09</h1>'
171 'h1. 2009\02\09' => '<h1>2009\02\09</h1>'
General Comments 0
You need to be logged in to leave comments. Login now