Experimental styling support for navigation bar

This commit is contained in:
Govindas 2022-02-02 16:51:46 +02:00
parent 5362f65c21
commit b46b283bf2
5 changed files with 19 additions and 3 deletions

1
example/footer Normal file
View File

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

View File

@ -1 +1,5 @@
>
<link href="/style.css" rel="stylesheet">
<style>.about > li > a { color: lightgreen; } </style>
About page
ee

View File

@ -1,3 +1,6 @@
>
<link href="/style.css" rel="stylesheet">
<style>.home > li > a { color: lightgreen; } </style>
# Welcome!
This is the homepage of our website.....
>

View File

@ -17,7 +17,14 @@ def generateNavigationBar(lines):
#parse markdown
if not rawhtml:
navbar = navbar.li(HTML(parseMarkdown(navbar, line)))
if ";" in line:
title, link = line.split(";", 1)
#div class for styling
navbar = navbar(HTML("<div class='" + title.replace(" ", "-").lower() + "'>"))
#link and end of div
navbar = navbar.li(HTML("<a href='" + link.strip() + "'>" + title + "</a></div>"))
def generateFooter(lines):
global footer
@ -55,6 +62,7 @@ def parseRawHTML(doc, line, htmlstring, rawhtml, id, maxlines):
rawhtml = False
doc.div(HTML(htmlstring))
htmlstring = ""
return rawhtml, doc, htmlstring
def parseMarkdown(doc, line):

View File

@ -1,2 +1,2 @@
[Home](/)
[About](/about)
About;/about
Home;/