summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/redcloth3.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb
index 7c9df0727..848aa7042 100644
--- a/lib/redcloth3.rb
+++ b/lib/redcloth3.rb
@@ -707,11 +707,13 @@ class RedCloth3 < String
atts = pba( atts )
# pass to prefix handler
+ replacement = nil
if respond_to? "textile_#{ tag }", true
- text.gsub!( $&, method( "textile_#{ tag }" ).call( tag, atts, cite, content ) )
+ replacement = method( "textile_#{ tag }" ).call( tag, atts, cite, content )
elsif respond_to? "textile_#{ tagpre }_", true
- text.gsub!( $&, method( "textile_#{ tagpre }_" ).call( tagpre, num, atts, cite, content ) )
+ replacement = method( "textile_#{ tagpre }_" ).call( tagpre, num, atts, cite, content )
end
+ text.gsub!( $& ) { replacement } if replacement
end
end