mirror of
https://github.com/grey-cat-1908/website.git
synced 2024-11-11 18:57:26 +03:00
Update build.py
This commit is contained in:
parent
ba528b140c
commit
c0b815c2c5
1 changed files with 8 additions and 13 deletions
21
build.py
21
build.py
|
@ -36,23 +36,18 @@ 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:
|
_, _, fier = directory.partition('/')
|
||||||
content = gen_file(f"{os.getcwd()}/{directory}/{filename}/index.md")
|
if len(fier) != 0: fier += "/"
|
||||||
|
|
||||||
_, _, fier = directory.partition('/')
|
if len(filename.split(".")) == 1:
|
||||||
if len(fier) != 0: fier += "/"
|
|
||||||
|
|
||||||
loc = f"{fier}{filename}/index.html"
|
|
||||||
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)
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
go_through("content")
|
go_through("content")
|
||||||
|
|
Loading…
Reference in a new issue