This commit is contained in:
BOHUNG 2020-03-26 19:29:13 +08:00
parent 75bcbe8159
commit b11a247303
1 changed files with 1 additions and 1 deletions

View File

@ -40,13 +40,13 @@ all_template.each do |folder|
filename = folder+'home/header.html.erb' filename = folder+'home/header.html.erb'
texts = File.read(filename) texts = File.read(filename)
texts_html = Nokogiri::HTML.parse(texts) texts_html = Nokogiri::HTML.parse(texts)
puts texts
if texts_html.css('.navbar-brand').length == 1 if texts_html.css('.navbar-brand').length == 1
new_texts = texts.gsub(texts_html.css('.navbar-brand').to_s.gsub("%7B",'{').gsub('%7D','}'),change_text) new_texts = texts.gsub(texts_html.css('.navbar-brand').to_s.gsub("%7B",'{').gsub('%7D','}'),change_text)
File.open(filename,'w') do |f| File.open(filename,'w') do |f|
f.write new_texts f.write new_texts
end end
elsif texts_html.css('.site-title >a').length == 1 && texts_html.css('.navbar-brand').length == 0 elsif texts_html.css('.site-title >a').length == 1 && texts_html.css('.navbar-brand').length == 0
puts texts
new_texts = texts.gsub(texts_html.css('.site-title >a').to_s.gsub("%7B",'{').gsub('%7D','}'),change_text) new_texts = texts.gsub(texts_html.css('.site-title >a').to_s.gsub("%7B",'{').gsub('%7D','}'),change_text)
File.open(filename,'w') do |f| File.open(filename,'w') do |f|
f.write new_texts f.write new_texts