From f79a6f701a6bd0ef086fbdb40c2bb7622f048afc Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 6 Nov 2010 13:29:23 +0000 Subject: [PATCH] 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 --- lib/redcloth3.rb | 2 +- test/unit/helpers/application_helper_test.rb | 14 -------------- .../lib/redmine/wiki_formatting/textile_formatter_test.rb | 8 ++++++++ 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb index ffc0e118..d720af9d 100644 --- a/lib/redcloth3.rb +++ b/lib/redcloth3.rb @@ -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| "#{$1}" end end diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 282a4cce..52bb1329 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -116,15 +116,6 @@ RAW assert textilizable(raw).include?('') end - def test_acronyms - to_test = { - 'this is an acronym: GPL(General Public License)' => 'this is an acronym: GPL', - 'GPL(This is a double-quoted "title")' => 'GPL', - } - to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } - - end - def test_attached_images to_test = { 'Inline image: !logo.gif!' => 'Inline image: This is a logo', @@ -401,11 +392,6 @@ EXPECTED assert_equal '

Dashes: ---

', textilizable('Dashes: ---') end - def test_acronym - assert_equal '

This is an acronym: ACLU.

', - textilizable('This is an acronym: ACLU(American Civil Liberties Union).') - end - def test_footnotes raw = <<-RAW This is some text[1]. diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb index d5fbd72c..a85687dc 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -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: GPL', + '2 letters JP(Jean-Philippe) acronym' => '2 letters JP acronym', + 'GPL(This is a double-quoted "title")' => 'GPL' + ) + end + private def assert_html_output(to_test) -- 2.11.0