Revision 1993
Added by Jean-Philippe Lang over 16 years ago
trunk/lib/redcloth3.rb | ||
---|---|---|
1051 | 1051 |
else |
1052 | 1052 |
htmlesc( aftertag, :NoQuotes ) if aftertag |
1053 | 1053 |
line = "<redpre##{ @pre_list.length }>" |
1054 |
@pre_list << "#{ $3.gsub(/<(#{ OFFTAGS })[^>]*>/, '<\\1>') }#{ aftertag }" |
|
1054 |
$3.match(/<#{ OFFTAGS }([^>]*)>/) |
|
1055 |
tag = $1 |
|
1056 |
$2.to_s.match(/(class\=\S+)/i) |
|
1057 |
tag << " #{$1}" if $1 |
|
1058 |
@pre_list << "<#{ tag }>#{ aftertag }" |
|
1055 | 1059 |
end |
1056 | 1060 |
elsif $1 and codepre > 0 |
1057 | 1061 |
if codepre - used_offtags.length > 0 |
trunk/test/unit/helpers/application_helper_test.rb | ||
---|---|---|
192 | 192 |
"<pre><div>content</div></pre>" => "<pre><div>content</div></pre>", |
193 | 193 |
"HTML comment: <!-- no comments -->" => "<p>HTML comment: <!-- no comments --></p>", |
194 | 194 |
"<!-- opening comment" => "<p><!-- opening comment</p>", |
195 |
# remove attributes |
|
196 |
"<pre class='foo'>some text</pre>" => "<pre>some text</pre>", |
|
195 |
# remove attributes except class |
|
196 |
"<pre class='foo'>some text</pre>" => "<pre class='foo'>some text</pre>", |
|
197 |
"<pre onmouseover='alert(1)'>some text</pre>" => "<pre>some text</pre>", |
|
197 | 198 |
} |
198 | 199 |
to_test.each { |text, result| assert_equal result, textilizable(text) } |
199 | 200 |
end |
... | ... | |
207 | 208 |
to_test.each { |text, result| assert_equal result, textilizable(text) } |
208 | 209 |
end |
209 | 210 |
|
211 |
def syntax_highlight |
|
212 |
raw = <<-RAW |
|
213 |
<pre><code class="ruby"> |
|
214 |
# Some ruby code here |
|
215 |
</pre></code> |
|
216 |
RAW |
|
217 | ||
218 |
expected = <<-EXPECTED |
|
219 |
<pre><code class="ruby CodeRay"><span class="no">1</span> <span class="c"># Some ruby code here</span> |
|
220 |
</pre></code> |
|
221 |
EXPECTED |
|
222 | ||
223 |
assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') |
|
224 |
end |
|
225 |
|
|
210 | 226 |
def test_wiki_links_in_tables |
211 | 227 |
to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" => |
212 | 228 |
'<tr><td><a href="/wiki/ecookbook/Page" class="wiki-page new">Link title</a></td>' + |
Also available in: Unified diff
Fixes syntax highlighting broken by r1930 (#2143).