Browse Source

fix: add flex page for buggy comment removal, and use a better sed

Xℹ Ruoyao 5 years ago
parent
commit
d8b1e46d53
1 changed files with 16 additions and 2 deletions
  1. 16 2
      zh_CN/fix.sh

+ 16 - 2
zh_CN/fix.sh

@@ -72,10 +72,24 @@ fi
 
 # Some buggy comments produced by po4a are adding extra empty lines.
 # Remove them.
-sed -e '/<screen.*><!--/,+1N;s/<!--.*-->\n//' -i \
+sed -n '
+1h
+1!{
+	/<screen[^\n]*><!--.*-->\n/!H
+	g
+	/<screen[^\n]*><!--.*-->\n/{
+		s/\(<screen[^\n]*>\)<!--.*-->\n/\1/
+		p
+		n
+		h
+	}
+}
+$p
+'   -i \
 	chapter02/hostreqs.xml                       \
 	chapter06/ncurses.xml                        \
-	chapter08/glibc.xml
+	chapter08/glibc.xml                          \
+	chapter08/flex.xml
 
 # Apply lfs-l10n.xml patch, if it's not applied
 grep "Simplified Chinese" stylesheets/lfs-xsl/lfs-l10n.xml ||