From ff88e9ad337e3862efc7bf90c6cbc0976de0d9c0 Mon Sep 17 00:00:00 2001 From: jiting Date: Thu, 12 Oct 2023 16:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E6=9C=AA?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E5=85=B3=E9=97=AD=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/update.rb b/update.rb index c5976fc..fd1b0c3 100644 --- a/update.rb +++ b/update.rb @@ -57,11 +57,14 @@ end # save to new file +file = File.open("src/lagos_zh.ts", "wb") zh_doc.write_xml_to( - File.open("src/lagos_zh.ts", "wb"), + file, indent: 4, save_with: Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS | Nokogiri::XML::Node::SaveOptions::FORMAT ) +file.flush +file.close # remove 4 space indent for every line between tag TS File.write("src/lagos_zh.ts", File.read("src/lagos_zh.ts").gsub(/\n {4}/, "\n"))