Revision 1517
Added by Jean-Philippe Lang about 17 years ago
trunk/lib/redcloth.rb | ||
---|---|---|
1149 | 1149 |
end |
1150 | 1150 |
end |
1151 | 1151 |
|
1152 |
ALLOWED_TAGS = %w(redpre pre code) |
|
1152 |
ALLOWED_TAGS = %w(redpre pre code notextile)
|
|
1153 | 1153 |
|
1154 | 1154 |
def escape_html_tags(text) |
1155 | 1155 |
text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" } |
trunk/test/unit/helpers/application_helper_test.rb | ||
---|---|---|
153 | 153 |
to_test.each { |text, result| assert_equal result, textilizable(text) } |
154 | 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 | 164 |
def test_wiki_links_in_tables |
157 | 165 |
to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" => |
158 | 166 |
'<tr><td><a href="/wiki/ecookbook/Page" class="wiki-page new">Link title</a></td>' + |
Also available in: Unified diff
Fixed: notextile tag has no effect.