From e1df23c768902aca8b7af78f6e2e75091be63cd3 Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Thu, 8 Feb 2024 20:47:44 +0100 Subject: [PATCH] Disable python line ending translation --- tools/doc/process_md_docs.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/doc/process_md_docs.py b/tools/doc/process_md_docs.py index b8c4dc21..9fd5f0cb 100755 --- a/tools/doc/process_md_docs.py +++ b/tools/doc/process_md_docs.py @@ -37,7 +37,7 @@ def remove_code_blocks(lines): def make_toc(file): - with open(file, "r") as f: + with open(file, "r", newline='') as f: lines = f.readlines() lines = remove_code_blocks(lines) @@ -61,7 +61,7 @@ def is_md_block_end(line): def extract_md_block(file, md_id): - with open(file, "r") as f: + with open(file, "r", newline='') as f: lines = f.readlines() result = "" md_block_started = False @@ -92,7 +92,7 @@ def get_string_between(s, after_what, before_what): def process_md_file(input_file, output_file): - with open(input_file, "r") as f: + with open(input_file, "r", newline='') as f: lines = f.readlines() content = "" @@ -108,19 +108,19 @@ def process_md_file(input_file, output_file): else: content = content + line - with open(output_file, "w") as f: + with open(output_file, "w", newline='') as f: f.write(content) def process_main_readme(repo_dir: str): - with open(repo_dir + "README.src.md", "r") as f: + with open(repo_dir + "README.src.md", "r", newline='') as f: readme_src_content = f.read() - with open(repo_dir + "/docs_src/intro.md", "r") as f: + with open(repo_dir + "/docs_src/intro.md", "r", newline='') as f: intro_content = f.read() readme_content = readme_src_content.replace("", intro_content) - with open(repo_dir + "README.md", "w") as f: + with open(repo_dir + "README.md", "w", newline='') as f: f.write(readme_content)