From b5298487d0e2ff356cc0bbeb71e96d8a3e032701 Mon Sep 17 00:00:00 2001 From: KIRCHSTH Date: Sat, 15 Jul 2023 23:59:50 +0200 Subject: [PATCH] release helper script .scripts/transform_files.py updates theme references in all *.md and *.puml files too (already used with v2.7.0) --- .scripts/transform_files.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.scripts/transform_files.py b/.scripts/transform_files.py index e16b96c..c18e8a2 100644 --- a/.scripts/transform_files.py +++ b/.scripts/transform_files.py @@ -229,7 +229,7 @@ def update_c4_next_beta_version(): def update_all_includes(): # reference tag version is with starting 'v' - print(f"updating include paths with new tag version {release_version} ...") + print(f"updating include/theme paths with new tag version {release_version} ...") files = glob.glob("./**/*", recursive=True) for file in files: if file.endswith(".puml") or file.endswith(".md"): @@ -239,8 +239,17 @@ def update_all_includes(): "!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/", f"!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/{release_version}/", ) - - print("include paths updated") + replace_in_file( + file, + "from https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/", + f"from https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/{release_version}/", + ) + replace_in_file( + file, + "](https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/themes/", + f"](https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/{release_version}/themes/", + ) + print(f"include/theme paths updated") def process_url_match(m: re.Match[str]): @@ -254,6 +263,14 @@ def process_url_match(m: re.Match[str]): "!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/", new_path, ) + replaced = replaced.replace( + "from https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/", + f"from https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/{release_version}/", + ) + replaced = replaced.replace( + "](https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/themes/", + f"](https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/{release_version}/themes/", + ) if new_path not in replaced: global found_not_replaced_include