# next if tog and method( tog ).call
# text.gsub! re, resub
#end
- text.gsub!(/\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/) do |m|
+ text.gsub!(/\b([A-Z][A-Z0-9]{1,})\b(?:[(]([^)]*)[)])/) do |m|
"<acronym title=\"#{htmlesc $2}\">#{$1}</acronym>"
end
end
assert textilizable(raw).include?('<img src="bar.gif" alt="" />')
end
- def test_acronyms
- to_test = {
- 'this is an acronym: GPL(General Public License)' => 'this is an acronym: <acronym title="General Public License">GPL</acronym>',
- 'GPL(This is a double-quoted "title")' => '<acronym title="This is a double-quoted "title"">GPL</acronym>',
- }
- to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
-
- end
-
def test_attached_images
to_test = {
'Inline image: !logo.gif!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />',
assert_equal '<p>Dashes: ---</p>', textilizable('Dashes: ---')
end
- def test_acronym
- assert_equal '<p>This is an acronym: <acronym title="American Civil Liberties Union">ACLU</acronym>.</p>',
- textilizable('This is an acronym: ACLU(American Civil Liberties Union).')
- end
-
def test_footnotes
raw = <<-RAW
This is some text[1].
)
end
+ def test_acronyms
+ assert_html_output(
+ 'this is an acronym: GPL(General Public License)' => 'this is an acronym: <acronym title="General Public License">GPL</acronym>',
+ '2 letters JP(Jean-Philippe) acronym' => '2 letters <acronym title="Jean-Philippe">JP</acronym> acronym',
+ 'GPL(This is a double-quoted "title")' => '<acronym title="This is a double-quoted "title"">GPL</acronym>'
+ )
+ end
+
private
def assert_html_output(to_test)