From 3a30ede63c41826ce1499948d60a21a7aca08e84 Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 26 Feb 2020 22:42:59 +0800 Subject: [PATCH] fix double add error --- announcement.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/announcement.gemspec b/announcement.gemspec index f5db13a..07dd5a6 100644 --- a/announcement.gemspec +++ b/announcement.gemspec @@ -37,7 +37,7 @@ all_template.each do |folder| i = texts.rindex(s1[-1]) texts[i] = "" end - regex_pattern = /.response-content {\n position: relative;\n}\n|.response-content[^{]*{[^}]*@media[^{]*{[^{]*}[^{]*@media[^{]*{[^{]*}[^}]*}[^}]*}/m + regex_pattern = /.response-content {\n position: static;\n}\n|.response-content {\n position: relative;\n}\n|.response-content[^{]*{[^}]*@media[^{]*{[^{]*}[^{]*@media[^{]*{[^{]*}[^}]*}[^}]*}/m if !texts.include? "$font-h1:" texts = "$font-h1: 1.5rem;\n$font-h2: 1.35rem;\n$font-h3: 1.2rem;\n$font-h4: 1.1rem;\n$font-h5: 1rem;\n$font-h6: 0.9rem;\n\n" + texts end @@ -64,7 +64,7 @@ all_template.each do |folder| f.write tp_last_text end end - if texts.split(regex_pattern).count > 1 + if texts.split(regex_pattern).count >= 1 auto_save_text = texts.scan(regex_pattern).join('') File.open(folder+'assets/stylesheets/template/base/_autobackup.bak', 'a') do |file| file.puts auto_save_text