Markdown Extra Formatter bugs » bluefeather_underscore_em.diff
| lib/bluefeather.rb | ||
|---|---|---|
|
|
||
|
|
||
|
# Pattern to match strong emphasis in Markdown text
|
||
|
BoldRegexp = %r{ (\*\*|__) (\S|\S.*?\S) \1 }x
|
||
|
BoldRegexp1 = %r{ \*\* (\S|\S.*?\S) \*\* }x
|
||
|
BoldRegexp2 = %r{ (^|\s) __ (\S|\S.*?\S) __ (\s|$) }x
|
||
|
|
||
|
# Pattern to match normal emphasis in Markdown text
|
||
|
ItalicRegexp = %r{ (\*|_) (\S|\S.*?\S) \1 }x
|
||
|
ItalicRegexp1 = %r{ \* (\S|\S.*?\S) \* }x
|
||
|
ItalicRegexp2 = %r{ (^|\s) _ (\S|\S.*?\S) _ (\s|$) }x
|
||
|
|
||
|
### Transform italic- and bold-encoded text in a copy of the specified +str+
|
||
|
### and return it.
|
||
| ... | ... | |
|
@log.debug " Transforming italic and bold"
|
||
|
|
||
|
str.
|
||
|
gsub( BoldRegexp, %{<strong>\\2</strong>} ).
|
||
|
gsub( ItalicRegexp, %{<em>\\2</em>} )
|
||
|
gsub( BoldRegexp1, %{<strong>\\1</strong>} ).
|
||
|
gsub( BoldRegexp2, %{<strong>\\2</strong>} ).
|
||
|
gsub( ItalicRegexp1, %{<em>\\1</em>} ).
|
||
|
gsub( ItalicRegexp2, %{\\1<em>\\2</em>\\3} )
|
||
|
end
|
||
|
|
||
|
|
||
- « Previous
- 1
- 2
- Next »