summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-19 20:46:08 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-19 20:46:08 +0000
commitdd79e8e31f780fa5e7c7ff10133a7cd1e8807653 (patch)
treef52983557b335bc0ea183d33d350289713220979 /lib
parentb7b1f640798a295a4d86f020a6888181cd9ad915 (diff)
downloadredmine-dd79e8e31f780fa5e7c7ff10133a7cd1e8807653.tar.gz
redmine-dd79e8e31f780fa5e7c7ff10133a7cd1e8807653.zip
Makes RedCloth3#retrieve MUCH faster (#18883).
git-svn-id: http://svn.redmine.org/redmine/trunk@13919 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redcloth3.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb
index eacd6d920..31a558799 100644
--- a/lib/redcloth3.rb
+++ b/lib/redcloth3.rb
@@ -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