diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 79e58346..24eb7c5b 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -147,6 +147,7 @@ module RepositoriesHelper ss_href = content.to_s.scan(href_regex) ss_href_1 = content.to_s.scan(href_regex_1) total_sources = {ss_c: ss_c,ss: ss, ss_1: ss_1, ss_2: ss_2, ss_src: ss_src, ss_src_1: ss_src_1, ss_src_2: ss_src_2, ss_src_3: ss_src_3, ss_src_4: ss_src_4, ss_src_5: ss_src_5, ss_href: ss_href, ss_href_1: ss_href_1} + puts total_sources # total_sources.uniq! total_sources.except(:ss, :ss_c).each do |k, sources| sources.each do |s| @@ -210,14 +211,14 @@ module RepositoriesHelper end end - after_ss_souces = content.to_s.scan(s_regex).uniq + after_ss_souces = content.to_s.scan(s_regex)#.uniq after_ss_souces.each_with_index do |s, index| + next if total_sources[:ss][index].nil? content = content.gsub("#{s[0]}","#{total_sources[:ss][index][0]}") end - after_ss_c_souces = content.to_s.scan(s_regex_c).uniq - puts after_ss_c_souces - puts total_sources + after_ss_c_souces = content.to_s.scan(s_regex_c)#.uniq after_ss_c_souces.each_with_index do |s, index| + next if total_sources[:ss_c][index].nil? content = content.gsub("#{s[0]}","#{total_sources[:ss_c][index][0]}") end return content