clean input and resources files

This commit is contained in:
Wolfang Torres
2026-06-20 11:51:49 +08:00
parent bc1c4ff048
commit ab495b6d31

View File

@@ -124,7 +124,11 @@ def write_input_file(process_file: ProcessFile, text: str):
with process_file.absolute_input_file.open(
"w", encoding="utf8", newline="\n"
) as file:
file.write(text)
for line in text.split("\n"):
line = line.strip()
if line:
file.write(f"{line}\n")
def write_resource_file(process_file: ProcessFile, language_id: str, text: str):
@@ -132,7 +136,10 @@ def write_resource_file(process_file: ProcessFile, language_id: str, text: str):
with process_file.dictionary_resource_file.open(
"w", encoding="utf8", newline="\n"
) as file:
file.write(text)
for line in text.split("\n"):
line = line.strip()
if line:
file.write(f"{line}\n")
def pre_process_a_dictionary_file(process_file: ProcessFile, language_id: str):