Add basic resources support

This commit is contained in:
Govindas 2022-01-31 12:56:41 +02:00
parent f46588afc3
commit 5869d0ebc7
2 changed files with 17 additions and 0 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ website-output
__pycache__
coverage.xml
/gsitegen/*.page
resources

View File

@ -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"