From d143019dbbb4b94f3474365655bd18e736c5b0bc Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 27 Oct 2008 11:50:23 +0000 Subject: [PATCH] Adds back textile acronyms support (#2077). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1956 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redcloth3.rb | 24 ++++++++++---------- test/unit/helpers/application_helper_test.rb | 5 ++++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb index 6815ecb7c..638ef6d97 100644 --- a/lib/redcloth3.rb +++ b/lib/redcloth3.rb @@ -401,22 +401,22 @@ class RedCloth3 < String # [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)\'/, '\1’' ], # single closing # [ /\'(?=[#{PUNCT_Q}]*(s\b|[\s#{PUNCT_NOQ}]))/, '’' ], # single closing # [ /\'/, '‘' ], # single opening - [ //, '>' ], # greater-than + # [ //, '>' ], # greater-than # [ /([^\s\[{(])?"(\s|:|$)/, '\1”\2' ], # double closing # [ /([^\s\[{(>#{PUNCT_Q}][#{PUNCT_Q}]*)"/, '\1”' ], # double closing # [ /"(?=[#{PUNCT_Q}]*[\s#{PUNCT_NOQ}])/, '”' ], # double closing # [ /"/, '“' ], # double opening - [ /\b( )?\.{3}/, '\1…' ], # ellipsis + # [ /\b( )?\.{3}/, '\1…' ], # ellipsis [ /\b([A-Z][A-Z0-9]{2,})\b(?:[(]([^)]*)[)])/, '\1' ], # 3+ uppercase acronym - [ /(^|[^"][>\s])([A-Z][A-Z0-9 ]+[A-Z0-9])([^\2\3', :no_span_caps ], # 3+ uppercase caps - [ /(\.\s)?\s?--\s?/, '\1—' ], # em dash - [ /\s->\s/, ' → ' ], # right arrow - [ /\s-\s/, ' – ' ], # en dash - [ /(\d+) ?x ?(\d+)/, '\1×\2' ], # dimension sign - [ /\b ?[(\[]TM[\])]/i, '™' ], # trademark - [ /\b ?[(\[]R[\])]/i, '®' ], # registered - [ /\b ?[(\[]C[\])]/i, '©' ] # copyright + # [ /(^|[^"][>\s])([A-Z][A-Z0-9 ]+[A-Z0-9])([^\2\3', :no_span_caps ], # 3+ uppercase caps + # [ /(\.\s)?\s?--\s?/, '\1—' ], # em dash + # [ /\s->\s/, ' → ' ], # right arrow + # [ /\s-\s/, ' – ' ], # en dash + # [ /(\d+) ?x ?(\d+)/, '\1×\2' ], # dimension sign + # [ /\b ?[(\[]TM[\])]/i, '™' ], # trademark + # [ /\b ?[(\[]R[\])]/i, '®' ], # registered + # [ /\b ?[(\[]C[\])]/i, '©' ] # copyright ] H_ALGN_VALS = { @@ -1010,7 +1010,7 @@ class RedCloth3 < String def glyphs_textile( text, level = 0 ) if text !~ HASTAG_MATCH - #pgl text + pgl text footnote_ref text else codepre = 0 diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 13fa262f1..6e1356bee 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -219,6 +219,11 @@ class ApplicationHelperTest < HelperTestCase 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]. -- 2.39.5