Update build.py

This commit is contained in:
Виктор 2023-12-26 10:51:21 +03:00 committed by GitHub
parent ba528b140c
commit c0b815c2c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,20 +36,15 @@ def gen_file(directory):
def go_through(directory): def go_through(directory):
for filename in os.listdir(directory): for filename in os.listdir(directory):
if len(filename.split(".")) == 1:
content = gen_file(f"{os.getcwd()}/{directory}/{filename}/index.md")
_, _, fier = directory.partition('/') _, _, fier = directory.partition('/')
if len(fier) != 0: fier += "/" if len(fier) != 0: fier += "/"
loc = f"{fier}{filename}/index.html" if len(filename.split(".")) == 1:
os.makedirs(f'build/{fier}{filename}') os.makedirs(f'build/{fier}{filename}')
go_through(directory + "/" + filename) go_through(directory + "/" + filename)
else: else:
# TODO: add support to ./././... content = gen_file(f"{os.getcwd()}/{directory}/{filename}")
content = gen_file(f"{os.getcwd()}/content/{filename}") loc = fier + filename.split(".")[0] + '.html'
loc = filename.split(".")[0] + '.html'
file = open(f"{os.getcwd()}/build/{loc}", "a") file = open(f"{os.getcwd()}/build/{loc}", "a")
file.write(content) file.write(content)