Bugfixes to navbar styling

This commit is contained in:
Govindas 2022-02-03 16:35:28 +02:00
parent e4b5175a68
commit aef5528bb0
1 changed files with 18 additions and 4 deletions

View File

@ -18,23 +18,37 @@ def generateNavigationBar(lines, pagetitle):
#parse navigation bar (custom format)
if not rawhtml:
if ";" in line:
#experimental dropdown parsing, to be removed or used soon
#contents = []
#if "|" in line:
# contents.append(line.split("|"))
#else:
# contents.append(line)
#for entry in contents:
title, link = line.split(";", 1)
#mark currently open tab as active when it is open
if link.strip() == pagetitle + ".page":
navbar = navbar(HTML("<div class='" + "active" + "'>"))
link = ""
link = "#"
elif link.strip() == homepage + ".page":
print(pagetitle)
link = "/"
else:
link = link.replace(" ", "-").replace(".page", "").lower()
#div class for styling
navbar = navbar(HTML("<div class='" + pagetitle.replace(" ", "-").lower() + "'>"))
navbar = navbar(HTML("<div class='" + title.replace(" ", "-").lower() + "'>"))
#link and end of div
navbar = navbar.li(HTML("<a href='" + link.strip() + "'>" + title + "</a></div></div>"))
if link == "#":
navbar = navbar.li(HTML("<a href='" + link.strip() + "'>" + title + "</a></div></div>"))
else:
navbar = navbar.li(HTML("<a href='" + link.strip() + "'>" + title + "</a></div>"))
else:
print("Error: invalid navbar entry, line " + str(id + 1) + " content: " + line)
exit()
return navbar
def generateFooter(lines):
global footer