Cleanup document, remove unnecessary join
This commit is contained in:
parent
4fc7dd18c0
commit
ba87ee895e
16
generate.py
16
generate.py
@ -27,7 +27,7 @@ def generateNavigationBar(lines):
|
||||
|
||||
def generateLines(title, lines):
|
||||
title = title.replace(".page", "")
|
||||
document = Document(title, lang="en")
|
||||
doc = Document(title, lang="en")
|
||||
rawhtml = False
|
||||
for line in lines:
|
||||
|
||||
@ -42,21 +42,21 @@ def generateLines(title, lines):
|
||||
html = html + line.strip()
|
||||
else:
|
||||
rawhtml = False
|
||||
document.join(HTML(html))
|
||||
doc(HTML(html))
|
||||
|
||||
#parse markdown
|
||||
else:
|
||||
md = markdown.markdown(line.strip())
|
||||
document.join(HTML(md))
|
||||
doc(HTML(md))
|
||||
|
||||
#if indented html was the last line, this is needed for it to not be ignored
|
||||
if rawhtml == True:
|
||||
rawhtml = False
|
||||
document.join(HTML(html))
|
||||
doc(HTML(html))
|
||||
|
||||
generatePage(title, document)
|
||||
generatePage(title, doc)
|
||||
|
||||
def generatePage(title, document):
|
||||
def generatePage(title, doc):
|
||||
#creates ./website-output/pagetitle/index.html file if it is not homepage
|
||||
foldername = ""
|
||||
|
||||
@ -66,9 +66,9 @@ def generatePage(title, document):
|
||||
|
||||
with open("./website-output" + foldername + "/index.html", 'w') as newpage:
|
||||
if 'navbar' in globals():
|
||||
newpage.write(str(E.ul(navbar).join(document)))
|
||||
newpage.write(str(E.ul(navbar)) + str(doc))
|
||||
else:
|
||||
newpage.write(str(document))
|
||||
newpage.write(str(doc))
|
||||
|
||||
if os.path.exists("./navbar"):
|
||||
with open("./navbar", 'r') as navbarfile:
|
||||
|
Loading…
Reference in New Issue
Block a user