Makes textile formatter accept 2 letters acronym (#6591).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4374 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
338e407a91
commit
f79a6f701a
|
@ -456,7 +456,7 @@ class RedCloth3 < String
|
||||||
# next if tog and method( tog ).call
|
# next if tog and method( tog ).call
|
||||||
# text.gsub! re, resub
|
# text.gsub! re, resub
|
||||||
#end
|
#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>"
|
"<acronym title=\"#{htmlesc $2}\">#{$1}</acronym>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -116,15 +116,6 @@ RAW
|
||||||
assert textilizable(raw).include?('<img src="bar.gif" alt="" />')
|
assert textilizable(raw).include?('<img src="bar.gif" alt="" />')
|
||||||
end
|
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
|
def test_attached_images
|
||||||
to_test = {
|
to_test = {
|
||||||
'Inline image: !logo.gif!' => 'Inline image: <img src="/attachments/download/3" title="This is a logo" alt="This is a logo" />',
|
'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
|
||||||
assert_equal '<p>Dashes: ---</p>', textilizable('Dashes: ---')
|
assert_equal '<p>Dashes: ---</p>', textilizable('Dashes: ---')
|
||||||
end
|
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
|
def test_footnotes
|
||||||
raw = <<-RAW
|
raw = <<-RAW
|
||||||
This is some text[1].
|
This is some text[1].
|
||||||
|
|
|
@ -78,6 +78,14 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
|
||||||
)
|
)
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def assert_html_output(to_test)
|
def assert_html_output(to_test)
|
||||||
|
|
Loading…
Reference in New Issue