##// END OF EJS Templates
Makes textile formatter accept 2 letters acronym (#6591)....
Jean-Philippe Lang -
r4260:f79a6f701a6b
parent child
Show More
@@ -456,7 +456,7 class RedCloth3 < String
456 # next if tog and method( tog ).call
456 # next if tog and method( tog ).call
457 # text.gsub! re, resub
457 # text.gsub! re, resub
458 #end
458 #end
459 text.gsub!(/\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/) do |m|
459 text.gsub!(/\b([A-Z][A-Z0-9]{1,})\b(?:[(]([^)]*)[)])/) do |m|
460 "<acronym title=\"#{htmlesc $2}\">#{$1}</acronym>"
460 "<acronym title=\"#{htmlesc $2}\">#{$1}</acronym>"
461 end
461 end
462 end
462 end
@@ -116,15 +116,6 RAW
116 assert textilizable(raw).include?('<img src="bar.gif" alt="" />')
116 assert textilizable(raw).include?('<img src="bar.gif" alt="" />')
117 end
117 end
118
118
119 def test_acronyms
120 to_test = {
121 'this is an acronym: GPL(General Public License)' => 'this is an acronym: <acronym title="General Public License">GPL</acronym>',
122 'GPL(This is a double-quoted "title")' => '<acronym title="This is a double-quoted &quot;title&quot;">GPL</acronym>',
123 }
124 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
125
126 end
127
128 def test_attached_images
119 def test_attached_images
129 to_test = {
120 to_test = {
130 'Inline image: !logo.gif!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />',
121 'Inline image: !logo.gif!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />',
@@ -401,11 +392,6 EXPECTED
401 assert_equal '<p>Dashes: ---</p>', textilizable('Dashes: ---')
392 assert_equal '<p>Dashes: ---</p>', textilizable('Dashes: ---')
402 end
393 end
403
394
404 def test_acronym
405 assert_equal '<p>This is an acronym: <acronym title="American Civil Liberties Union">ACLU</acronym>.</p>',
406 textilizable('This is an acronym: ACLU(American Civil Liberties Union).')
407 end
408
409 def test_footnotes
395 def test_footnotes
410 raw = <<-RAW
396 raw = <<-RAW
411 This is some text[1].
397 This is some text[1].
@@ -78,6 +78,14 class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
78 )
78 )
79 end
79 end
80
80
81 def test_acronyms
82 assert_html_output(
83 'this is an acronym: GPL(General Public License)' => 'this is an acronym: <acronym title="General Public License">GPL</acronym>',
84 '2 letters JP(Jean-Philippe) acronym' => '2 letters <acronym title="Jean-Philippe">JP</acronym> acronym',
85 'GPL(This is a double-quoted "title")' => '<acronym title="This is a double-quoted &quot;title&quot;">GPL</acronym>'
86 )
87 end
88
81 private
89 private
82
90
83 def assert_html_output(to_test)
91 def assert_html_output(to_test)
General Comments 0
You need to be logged in to leave comments. Login now