This commit is contained in:
BoHung Chiu 2023-01-30 11:21:41 +08:00
parent c490f060ff
commit 7616e05258
1 changed files with 4 additions and 4 deletions

View File

@ -852,18 +852,18 @@ class Admin::PersonalPluginFieldsController < OrbitMemberController
return new_text return new_text
end end
def include_key(text,key) def include_key(text,key)
return text.include?(key) || text.include?(key.classify) return text.include?(key) || text.include?(key.camelize)
end end
def gsub_text_by_key_value(text,k,v) def gsub_text_by_key_value(text,k,v)
@blank_texts = [] @blank_texts = []
if !@parse_again_mode if !@parse_again_mode
text.gsub(/\n(\s+)[^\n]*(#{k}|#{k.classify})/m) {|ff| @blank_texts << $1.gsub(/(\r\n|\n)/,'')} text.gsub(/\n(\s+)[^\n]*(#{k}|#{k.camelize})/m) {|ff| @blank_texts << $1.gsub(/(\r\n|\n)/,'')}
end end
i = 0 i = 0
text = text.gsub(k + "s"){|ff| v.pluralize.gsub("\n","\n#{@blank_texts[i]}")} text = text.gsub(k + "s"){|ff| v.pluralize.gsub("\n","\n#{@blank_texts[i]}")}
text = text.gsub(k ){|ff| v.gsub("\n","\n#{@blank_texts[i]}")} text = text.gsub(k ){|ff| v.gsub("\n","\n#{@blank_texts[i]}")}
text = text.gsub(k.classify + "s"){|ff| v.classify.pluralize.gsub("\n","\n#{@blank_texts[i]}")} text = text.gsub(k.camelize + "s"){|ff| v.camelize.pluralize.gsub("\n","\n#{@blank_texts[i]}")}
text = text.gsub(k.classify){|ff| v.classify.gsub("\n","\n#{@blank_texts[i]}")} text = text.gsub(k.camelize){|ff| v.camelize.gsub("\n","\n#{@blank_texts[i]}")}
end end
def get_all_gem_plugins def get_all_gem_plugins
extention_files = ["downloaded_extensions.rb","built_in_extensions.rb"] extention_files = ["downloaded_extensions.rb","built_in_extensions.rb"]