Kaynağa Gözat

format_xml.sh 保留行色

robert 4 yıl önce
ebeveyn
işleme
599a0a44d5
2 değiştirilmiş dosya ile 9 ekleme ve 6 silme
  1. 3 0
      format_xml.sh
  2. 6 6
      style.awk

+ 3 - 0
format_xml.sh

@@ -16,6 +16,9 @@ git diff  --name-only  HEAD 策划脚本| grep '\.xml$'|xargs sed -b -i \
     -e '/<Column /,/\/>/d' \
     -e '/<ConditionalFormatting xmlns/,/<\/ConditionalFormatting>/d' \
     -e '/<WorksheetOptions xmlns/,/<\/WorksheetOptions>/d' \
+    -e '/^ *<Cell[ >]/s/ ss:StyleID="\w\+"//g' \
+    -e '/^ *<Cell /,/<\/Cell>/s/ ss:StyleID="\w\+"//g' \
+    -e '/^ *<Row /s/\( ss:StyleID=\)"\w\+"/\1"s1"/g' \
     -e '/^ *<Split/d' 
 # /usr/bin/find  策划脚本 -name '*.xml' | xargs sed -b -i \
 git diff  --name-only  HEAD 策划脚本| grep '\.xml$'|xargs sed -b -i \

+ 6 - 6
style.awk

@@ -18,12 +18,12 @@ BEGIN{
     if(match($0,"^ *<Row[ >]")){
         if(rows<4)rows++
     }
-    if(rows>-1){
-        if(rows<4)
-            gsub(" ss:StyleID=\"\\w+\""," ss:StyleID=\"s1\"",$0)
-        else
-            gsub(" ss:StyleID=\"\\w+\"","",$0)
-    }
+    # if(rows>-1){
+    #     if(rows<4)
+    #         gsub(" ss:StyleID=\"\\w+\""," ss:StyleID=\"s1\"",$0)
+    #     else
+    #         gsub(" ss:StyleID=\"\\w+\"","",$0)
+    # }
     # if(match($0,"^ *<Style ")){
         # if(styles<3) styles++
     # }