correctly rename non .html files when only converting one file

This commit is contained in:
truePhilipp committed 2024-05-10 10:31:06 +00:00
1 parent 0487b39737
commit de35de34cd
3 files changed
+36 -1

No files matched your search

+2 -1
View File
@@ -61,7 +61,8 @@ def convert_file(path: str, overwrite: bool = False) -> None:
if overwrite:
out_path = path
else:
out_path = path.replace(".html", ".n.html")
filename, file_extension = os.path.splitext(path)
out_path = f"{filename}.n{file_extension}"
with open(out_path, "w") as file:
for lib in required_libraries:
file.write(f"{{% load {lib} %}}\n")