diff --git a/lib/redcloth.rb b/lib/redcloth.rb index 3880eb9d..42eddd8e 100644 --- a/lib/redcloth.rb +++ b/lib/redcloth.rb @@ -1149,7 +1149,7 @@ class RedCloth < String end end - ALLOWED_TAGS = %w(redpre pre code) + ALLOWED_TAGS = %w(redpre pre code notextile) def escape_html_tags(text) text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" } diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 4f8ededd..1e75dbd6 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -153,6 +153,14 @@ class ApplicationHelperTest < HelperTestCase to_test.each { |text, result| assert_equal result, textilizable(text) } end + def test_allowed_html_tags + to_test = { + "
preformatted text
" => "
preformatted text
", + "no *textile* formatting" => "no *textile* formatting", + } + to_test.each { |text, result| assert_equal result, textilizable(text) } + end + def test_wiki_links_in_tables to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" => 'Link title' +