Experimental footer, identical to navbar
This commit is contained in:
parent
509824e2d2
commit
f46588afc3
1
gsitegen/footer
Normal file
1
gsitegen/footer
Normal file
@ -0,0 +1 @@
|
|||||||
|
[Privacy Policy](/privacy-policy)
|
@ -19,6 +19,20 @@ def generateNavigationBar(lines):
|
|||||||
if not rawhtml:
|
if not rawhtml:
|
||||||
navbar = navbar.li(HTML(parseMarkdown(navbar, line)))
|
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):
|
def parseRawHTML(doc, line, htmlstring, rawhtml, id, maxlines):
|
||||||
|
|
||||||
#raw html start
|
#raw html start
|
||||||
@ -68,14 +82,19 @@ def generateLines(title, lines):
|
|||||||
def generatePage(title, doc):
|
def generatePage(title, doc):
|
||||||
global pages
|
global pages
|
||||||
global titles
|
global titles
|
||||||
|
|
||||||
if 'pages' not in globals():
|
if 'pages' not in globals():
|
||||||
pages = []
|
pages = []
|
||||||
if 'titles' not in globals():
|
if 'titles' not in globals():
|
||||||
titles = []
|
titles = []
|
||||||
|
|
||||||
if 'navbar' in globals():
|
if 'navbar' in globals():
|
||||||
|
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))
|
pages.append(str(E.ul(navbar)) + str(doc))
|
||||||
|
else:
|
||||||
|
if 'footer' in globals():
|
||||||
|
pages.append(str(doc) + str(E.ul(footer)))
|
||||||
else:
|
else:
|
||||||
pages.append(str(doc))
|
pages.append(str(doc))
|
||||||
titles.append(title)
|
titles.append(title)
|
||||||
@ -126,6 +145,14 @@ def main():
|
|||||||
else:
|
else:
|
||||||
print("No 'navbar' file found, there will be no navigation bar.")
|
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
|
pagescount = 0
|
||||||
|
|
||||||
for file in Path(__file__).parent.iterdir():
|
for file in Path(__file__).parent.iterdir():
|
||||||
|
Loading…
Reference in New Issue
Block a user