]> source.dussan.org Git - redmine.git/commitdiff
Fixed: bold, italics, underline not working within parentheses (#1225).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 18 May 2008 08:24:31 +0000 (08:24 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 18 May 2008 08:24:31 +0000 (08:24 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1434 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redcloth.rb
test/unit/helpers/application_helper_test.rb

index 7729ced469ab887d509d81a3a3ceab63c7c2d8b4..f94c9573888b24fa0407a02ad3fce10ebd88ac89 100644 (file)
@@ -376,13 +376,13 @@ class RedCloth < String
         re =
             case rtype
             when :limit
-                /(^|[>\s])
+                /(^|[>\s\(])
                 (#{rcq})
                 (#{C})
                 (?::(\S+?))?
                 ([^\s\-].*?[^\s\-]|\w)
                 #{rcq}
-                (?=[[:punct:]]|\s|$)/x
+                (?=[[:punct:]]|\s|\)|$)/x
             else
                 /(#{rcq})
                 (#{C})
index e8b5883ce3830b88ef87aa5cc43237268d187c4f..8bd74512496dad4071bf018100cab386c7e9d2c2 100644 (file)
@@ -162,6 +162,13 @@ class ApplicationHelperTest < HelperTestCase
     to_test.each { |text, result| assert_equal "<table>#{result}</table>", textilizable(text).gsub(/[\t\n]/, '') }
   end
   
+  def test_text_formatting
+    to_test = {'*_+bold, italic and underline+_*' => '<strong><em><ins>bold, italic and underline</ins></em></strong>',
+               '(_text within parentheses_)' => '(<em>text within parentheses</em>)'
+              }
+    to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
+  end
+  
   def test_wiki_horizontal_rule
     assert_equal '<hr />', textilizable('---')
     assert_equal '<p>Dashes: ---</p>', textilizable('Dashes: ---')