From dbcf4e76f4a4b0e99dae1bf6b4121cc2ae84e766 Mon Sep 17 00:00:00 2001 From: Ben Puls Date: Thu, 29 Aug 2024 18:52:02 +0500 Subject: [PATCH] Refactor code to improve readability --- utility/extract_release_notes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utility/extract_release_notes.py b/utility/extract_release_notes.py index cfb970d..cbe17c6 100644 --- a/utility/extract_release_notes.py +++ b/utility/extract_release_notes.py @@ -7,7 +7,8 @@ if len(sys.argv) < 3: file_name = sys.argv[1] save_file_name = sys.argv[2] - + + def build_html(data, first_launch=False): html = "" for i, element in enumerate(data): @@ -23,6 +24,7 @@ def build_html(data, first_launch=False): html += f"<{element['value']}>{build_html(element['children'])}" return html + with open(file_name, "r", encoding='utf-8') as file: translation = json.load(file) @@ -34,4 +36,4 @@ for element_key in translation.keys(): notes[element_key] = build_html(translation[element_key], True) with open(save_file_name, "w", encoding='utf-8') as file: - file.write(json.dumps(notes, ensure_ascii=False, indent=4)) \ No newline at end of file + file.write(json.dumps(notes, ensure_ascii=False, indent=4))