more formatting

This commit is contained in:
truePhilipp committed 2024-05-05 20:48:28 +02:00
1 parent 42715de295
commit b042a297b5
5 files changed
+55 -5

No files matched your search

+4 -2
View File
@@ -18,7 +18,9 @@ def convert_file(path: str, overwrite: bool = False) -> None:
out_path = path.replace(".html", ".n.html")
with open(out_path, "w") as file:
file.write("{% load static %}\n")
file.write(soup.prettify(formatter=bs4.formatter.HTMLFormatter(indent=4)))
file.write(soup
.prettify(formatter=bs4.formatter.HTMLFormatter(indent=4))
.replace(""", '"')) # Could this cause any issues? (maybe in attributes)
def convert_dir(path: str, overwrite: bool = False) -> None:
@@ -29,6 +31,6 @@ def convert_dir(path: str, overwrite: bool = False) -> None:
def command_entry() -> None:
path = os.path.abspath(sys.argv[1])
if os.path.isdir(path):
convert_dir(path)
convert_dir(path, True)
elif os.path.isfile(path):
convert_file(path)