Skip to content

Commit

Permalink
Quick hack at fixing the ruby_method_names bug in BlueCloth .. tests …
Browse files Browse the repository at this point in the history
…all pass now :)
  • Loading branch information
courtenay committed Dec 20, 2008
1 parent 7856b7b commit 8f19227
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/bluecloth/transform/inline.rb
Expand Up @@ -19,19 +19,27 @@ def apply_span_transforms( str, rs )
end

# Pattern to match strong emphasis in Markdown text
BoldRegexp = %r{ (\*\*|__) (\S|\S.+?\S) \1 }x

BoldRegexps = [
%r{ \b(\_\_) (\S|\S.*?\S) \1\b }x,
%r{ (\*\*) (\S|\S.*?\S) \1 }x
]

# Pattern to match normal emphasis in Markdown text
ItalicRegexp = %r{ (\*|_) (\S|\S.+?\S) \1 }x
ItalicRegexps = [
%r{ (\*) (\S|\S.*?\S) \1 }x,
%r{ \b(_) (\S|\S.*?\S) \1\b }x
]

# Transform italic- and bold-encoded text in a copy of the specified +str+
# and return it.
def transform_italic_and_bold( str, rs )
@log.debug " Transforming italic and bold"

str.
gsub( BoldRegexp, %{<strong>\\2</strong>} ).
gsub( ItalicRegexp, %{<em>\\2</em>} )
gsub( BoldRegexps[0], %{<strong>\\2</strong>} ).
gsub( BoldRegexps[1], %{<strong>\\2</strong>} ).
gsub( ItalicRegexps[0], %{<em>\\2</em>} ).
gsub( ItalicRegexps[1], %{<em>\\2</em>} )
end

# Transform backticked spans into <code> spans.
Expand Down

0 comments on commit 8f19227

Please sign in to comment.