]> source.dussan.org Git - redmine.git/commitdiff
Makes RedCloth3#retrieve MUCH faster (#18883).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 19 Jan 2015 20:46:08 +0000 (20:46 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 19 Jan 2015 20:46:08 +0000 (20:46 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@13919 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redcloth3.rb

index eacd6d92045b868fb84c56a6ea2d44441ef152df..31a558799ada2aca7b6389f244fb14d1237e92e8 100644 (file)
@@ -986,8 +986,8 @@ class RedCloth3 < String
     end
     
     def retrieve( text ) 
-        @shelf.each_with_index do |r, i|
-            text.gsub!( " :redsh##{ i + 1 }:", r )
+        text.gsub!(/ :redsh#(\d+):/) do
+          @shelf[$1.to_i - 1] || $&
         end
     end