@@ -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]*) |
|
1205 | text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' 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_ |
|
163 | def test_escaping | |
164 | assert_html_output( |
|
164 | assert_html_output( | |
165 | 'this is a <script>' => 'this is a <script>' |
|
165 | 'this is a <script>' => 'this is a <script>' | |
166 | ) |
|
166 | ) | |
167 | end |
|
167 | end | |
168 |
|
168 | |||
169 | def test_should_escape_less_than_signs |
|
|||
170 | assert_html_output( |
|
|||
171 | '<' => '<', |
|
|||
172 | '1 < 2' => '1 < 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