Add basic resources support
This commit is contained in:
parent
f46588afc3
commit
5869d0ebc7
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ website-output
|
||||
__pycache__
|
||||
coverage.xml
|
||||
/gsitegen/*.page
|
||||
resources
|
||||
|
@ -132,6 +132,22 @@ def writePages(homepage):
|
||||
newpage.write(page)
|
||||
print("Written changed page: " + titles[id])
|
||||
|
||||
#resources
|
||||
respath = Path(__file__).parent.joinpath("resources")
|
||||
if respath.exists():
|
||||
for item in respath.iterdir():
|
||||
if item.is_dir():
|
||||
dir = item.name.replace(" ", "-").lower()
|
||||
|
||||
#loop all files within page's directory
|
||||
for file in item.iterdir():
|
||||
dest = Path(__file__).parent.joinpath("website-output" + "/" + dir + "/" + file.name)
|
||||
#TODO write only if file has changed
|
||||
dest.write_bytes(file.read_bytes())
|
||||
else:
|
||||
dest = Path(__file__).parent.joinpath("website-output" + "/" + item.name)
|
||||
#TODO write only if file has changed
|
||||
dest.write_bytes(item.read_bytes())
|
||||
def main():
|
||||
|
||||
#if homepage is at Home.page, set homepage to "Home"
|
||||
|
Loading…
Reference in New Issue
Block a user