Experimental footer, identical to navbar

This commit is contained in:
Govindas 2022-01-31 12:11:51 +02:00
parent 509824e2d2
commit f46588afc3
2 changed files with 31 additions and 3 deletions

1
gsitegen/footer Normal file
View File

@ -0,0 +1 @@
[Privacy Policy](/privacy-policy)

View File

@ -19,6 +19,20 @@ def generateNavigationBar(lines):
if not rawhtml:
navbar = navbar.li(HTML(parseMarkdown(navbar, line)))
def generateFooter(lines):
global footer
footer = E
rawhtml = False
htmlstring = ""
for id, line in enumerate(lines):
#parse raw HTML
rawhtml, footer, htmlstring = parseRawHTML(footer, line, htmlstring, rawhtml, id, len(lines))
#parse markdown
if not rawhtml:
footer = footer.li(HTML(parseMarkdown(footer, line)))
def parseRawHTML(doc, line, htmlstring, rawhtml, id, maxlines):
#raw html start
@ -68,16 +82,21 @@ def generateLines(title, lines):
def generatePage(title, doc):
global pages
global titles
if 'pages' not in globals():
pages = []
if 'titles' not in globals():
titles = []
if 'navbar' in globals():
pages.append(str(E.ul(navbar)) + str(doc))
if 'footer' in globals():
pages.append(str(E.ul(navbar)) + str(doc) + str(E.ul(footer)))
else:
pages.append(str(E.ul(navbar)) + str(doc))
else:
pages.append(str(doc))
if 'footer' in globals():
pages.append(str(doc) + str(E.ul(footer)))
else:
pages.append(str(doc))
titles.append(title)
def writePages(homepage):
@ -126,6 +145,14 @@ def main():
else:
print("No 'navbar' file found, there will be no navigation bar.")
footerfile = Path(__file__).parent.joinpath('footer')
if footerfile.exists():
with footerfile.open('r') as footerfile:
generateFooter(footerfile.readlines())
else:
print("No 'footer' file found, there will be no footer.")
pagescount = 0
for file in Path(__file__).parent.iterdir():