##// END OF EJS Templates
Fixes syntax highlighting broken by r1930 (#2143)....
Jean-Philippe Lang -
r1991:9ae6e60c260e
parent child
Show More
@@ -1051,7 +1051,11 class RedCloth3 < String
1051 else
1051 else
1052 htmlesc( aftertag, :NoQuotes ) if aftertag
1052 htmlesc( aftertag, :NoQuotes ) if aftertag
1053 line = "<redpre##{ @pre_list.length }>"
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 end
1059 end
1056 elsif $1 and codepre > 0
1060 elsif $1 and codepre > 0
1057 if codepre - used_offtags.length > 0
1061 if codepre - used_offtags.length > 0
@@ -192,8 +192,9 class ApplicationHelperTest < HelperTestCase
192 "<pre><div>content</div></pre>" => "<pre>&lt;div&gt;content&lt;/div&gt;</pre>",
192 "<pre><div>content</div></pre>" => "<pre>&lt;div&gt;content&lt;/div&gt;</pre>",
193 "HTML comment: <!-- no comments -->" => "<p>HTML comment: &lt;!-- no comments --&gt;</p>",
193 "HTML comment: <!-- no comments -->" => "<p>HTML comment: &lt;!-- no comments --&gt;</p>",
194 "<!-- opening comment" => "<p>&lt;!-- opening comment</p>",
194 "<!-- opening comment" => "<p>&lt;!-- opening comment</p>",
195 # remove attributes
195 # remove attributes except class
196 "<pre class='foo'>some text</pre>" => "<pre>some text</pre>",
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 to_test.each { |text, result| assert_equal result, textilizable(text) }
199 to_test.each { |text, result| assert_equal result, textilizable(text) }
199 end
200 end
@@ -207,6 +208,21 class ApplicationHelperTest < HelperTestCase
207 to_test.each { |text, result| assert_equal result, textilizable(text) }
208 to_test.each { |text, result| assert_equal result, textilizable(text) }
208 end
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 def test_wiki_links_in_tables
226 def test_wiki_links_in_tables
211 to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" =>
227 to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" =>
212 '<tr><td><a href="/wiki/ecookbook/Page" class="wiki-page new">Link title</a></td>' +
228 '<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