@@ -1149,7 +1149,7 class RedCloth < String | |||||
1149 | end |
|
1149 | end | |
1150 | end |
|
1150 | end | |
1151 |
|
1151 | |||
1152 | ALLOWED_TAGS = %w(redpre pre code) |
|
1152 | ALLOWED_TAGS = %w(redpre pre code notextile) | |
1153 |
|
1153 | |||
1154 | def escape_html_tags(text) |
|
1154 | def escape_html_tags(text) | |
1155 | text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" } |
|
1155 | text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" } |
@@ -153,6 +153,14 class ApplicationHelperTest < HelperTestCase | |||||
153 | to_test.each { |text, result| assert_equal result, textilizable(text) } |
|
153 | to_test.each { |text, result| assert_equal result, textilizable(text) } | |
154 | end |
|
154 | end | |
155 |
|
155 | |||
|
156 | def test_allowed_html_tags | |||
|
157 | to_test = { | |||
|
158 | "<pre>preformatted text</pre>" => "<pre>preformatted text</pre>", | |||
|
159 | "<notextile>no *textile* formatting</notextile>" => "no *textile* formatting", | |||
|
160 | } | |||
|
161 | to_test.each { |text, result| assert_equal result, textilizable(text) } | |||
|
162 | end | |||
|
163 | ||||
156 | def test_wiki_links_in_tables |
|
164 | def test_wiki_links_in_tables | |
157 | to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" => |
|
165 | to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" => | |
158 | '<tr><td><a href="/wiki/ecookbook/Page" class="wiki-page new">Link title</a></td>' + |
|
166 | '<tr><td><a href="/wiki/ecookbook/Page" class="wiki-page new">Link title</a></td>' + |
General Comments 0
You need to be logged in to leave comments.
Login now