From 1907c31138d065aea93f53b8e7565e06a44e49f8 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 18 May 2008 08:24:31 +0000 Subject: [PATCH] Fixed: bold, italics, underline not working within parentheses (#1225). git-svn-id: http://redmine.rubyforge.org/svn/trunk@1434 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redcloth.rb | 4 ++-- test/unit/helpers/application_helper_test.rb | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/redcloth.rb b/lib/redcloth.rb index 7729ced46..f94c95738 100644 --- a/lib/redcloth.rb +++ b/lib/redcloth.rb @@ -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}) diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index e8b5883ce..8bd745124 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -162,6 +162,13 @@ class ApplicationHelperTest < HelperTestCase to_test.each { |text, result| assert_equal "#{result}
", textilizable(text).gsub(/[\t\n]/, '') } end + def test_text_formatting + to_test = {'*_+bold, italic and underline+_*' => 'bold, italic and underline', + '(_text within parentheses_)' => '(text within parentheses)' + } + to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } + end + def test_wiki_horizontal_rule assert_equal '
', textilizable('---') assert_equal '

Dashes: ---

', textilizable('Dashes: ---')