From 53072ff5f2cff06de4f41aba1a742feb51b45add Mon Sep 17 00:00:00 2001 From: Maria Grandury Date: Mon, 28 Aug 2023 17:18:09 +0200 Subject: [PATCH] chore: use delimiters to generate readme --- .github/scripts/generate_datasets_table.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/scripts/generate_datasets_table.py b/.github/scripts/generate_datasets_table.py index e0647d5..b582e38 100644 --- a/.github/scripts/generate_datasets_table.py +++ b/.github/scripts/generate_datasets_table.py @@ -10,9 +10,19 @@ table_content = df.to_markdown(index=False) with open("README.md", "r") as f: - readme_content = f.read() + readme_template = f.read() -updated_readme_content = readme_content.replace("", table_content) +start_delimiter = "" +end_delimiter = "" + +start_pos = readme_template.find(start_delimiter) +end_pos = readme_template.find(end_delimiter) + +updated_readme_content = ( + readme_template[:start_pos + len(start_delimiter)] + + "\n" + table_content + "\n" + + readme_template[end_pos:] +) with open("README.md", "w") as f: f.write(updated_readme_content)