Skip to content

Commit 6dc2cf2

Browse files
authored
Add former index.html (#437)
1 parent ec53973 commit 6dc2cf2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/combine_docs.py

+11
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@ def rename_copy_subpackage_html_paths(subpackage: str, subpackage_path: Path, op
7979

8080
shutil.copyfile(html_path, new_path_in_optimum)
8181

82+
# Temporary hack to have a working URL to the former subpackage_index.html
83+
if html_path.name == "index.html":
84+
former_index_path = Path(
85+
f"{optimum_path}/optimum/{version}/{language_folder}/{subpackage}_{html_path.name}"
86+
)
87+
with new_path_in_optimum.open("r") as html_file:
88+
html_string = html_file.read()
89+
with former_index_path.open("w") as html_file:
90+
# Copy the content of index.html and update the relative links
91+
html_file.write(html_string.replace('href="./', f'href="./{subpackage}/'))
92+
8293

8394
def main():
8495
args = parser.parse_args()

0 commit comments

Comments
 (0)