From 215a94bfa5645edbc4b9535175d2d0c50f2ad41f Mon Sep 17 00:00:00 2001 From: regisss Date: Thu, 27 Oct 2022 21:52:59 +0200 Subject: [PATCH] Add former index.html --- docs/combine_docs.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/combine_docs.py b/docs/combine_docs.py index 052bfcc506..9011e91a18 100755 --- a/docs/combine_docs.py +++ b/docs/combine_docs.py @@ -79,6 +79,17 @@ def rename_copy_subpackage_html_paths(subpackage: str, subpackage_path: Path, op shutil.copyfile(html_path, new_path_in_optimum) + # Temporary hack to have a working URL to the former subpackage_index.html + if html_path.name == "index.html": + former_index_path = Path( + f"{optimum_path}/optimum/{version}/{language_folder}/{subpackage}_{html_path.name}" + ) + with new_path_in_optimum.open("r") as html_file: + html_string = html_file.read() + with former_index_path.open("w") as html_file: + # Copy the content of index.html and update the relative links + html_file.write(html_string.replace('href="./', f'href="./{subpackage}/')) + def main(): args = parser.parse_args()