]> source.dussan.org Git - redmine.git/commitdiff
Makes textile formatter accept 2 letters acronym (#6591).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 6 Nov 2010 13:29:23 +0000 (13:29 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 6 Nov 2010 13:29:23 +0000 (13:29 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4374 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redcloth3.rb
test/unit/helpers/application_helper_test.rb
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb

index ffc0e1186be039722da0f6bc336b7216e04d83a0..d720af9d8cf0008e4fc8408452b52b857b912219 100644 (file)
@@ -456,7 +456,7 @@ class RedCloth3 < String
         #    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
index 282a4cced27db56e725c1cce8865af55b4b7a197..52bb13298149a27b9c8cf3d3d55306c3557c403e 100644 (file)
@@ -116,15 +116,6 @@ RAW
     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 &quot;title&quot;">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" />',
@@ -401,11 +392,6 @@ EXPECTED
     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].
index d5fbd72ce27c2eebc570121a0244301253345d8c..a85687dcaff81c4764da3b90998163ea5eb4bde3 100644 (file)
@@ -78,6 +78,14 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase
     )
   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 &quot;title&quot;">GPL</acronym>'
+    )
+  end
+  
   private
   
   def assert_html_output(to_test)