ya hz zarabotaet ili net. ya s github'a redaktiruyu

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

View file

@ -34,16 +34,26 @@ def gen_file(directory):
return template_text.replace("{{%CONTENT%}}", render(md_text)) return template_text.replace("{{%CONTENT%}}", render(md_text))
def go_through(directory):
for filename in os.listdir(directory):
if len(filename.split(".")) == 1:
content = gen_file(f"{os.getcwd()}/{directory}/{filename}/index.md")
for filename in os.listdir("content"): fier = content[content.find('/'):]
if len(filename.split(".")) == 1:
content = gen_file(f"{os.getcwd()}/content/{filename}/index.md")
loc = f"{filename}/index.html"
os.makedirs(f'build/{filename}')
else:
content = gen_file(f"{os.getcwd()}/content/{filename}")
loc = filename.split(".")[0] + '.html'
file = open(f"{os.getcwd()}/build/{loc}", "a") if len(fier) != 0: fier += ""/
file.write(content)
file.close() loc = f"{fier}{filename}/index.html"
os.makedirs(f'build/{fier}{filename}')
go_through(directory + "/" + filename)
else:
# TODO: add support to ./././...
content = gen_file(f"{os.getcwd()}/content/{filename}")
loc = filename.split(".")[0] + '.html'
file = open(f"{os.getcwd()}/build/{loc}", "a")
file.write(content)
file.close()
go_through("content")