document does not need to be global
This commit is contained in:
parent
a5785092c4
commit
1e02f03a0f
@ -25,16 +25,15 @@ def generateNavigationBar(lines):
|
|||||||
navbar = navbar.li(HTML("<a href='" + link + "'>" + title + "</a>"))
|
navbar = navbar.li(HTML("<a href='" + link + "'>" + title + "</a>"))
|
||||||
|
|
||||||
def generateLines(title, lines):
|
def generateLines(title, lines):
|
||||||
global document
|
|
||||||
title = title.replace(".page", "")
|
title = title.replace(".page", "")
|
||||||
document = Document(title, lang="en")
|
document = Document(title, lang="en")
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
document.p(line.strip())
|
document.p(line.strip())
|
||||||
|
|
||||||
generatePage(title)
|
generatePage(title, document)
|
||||||
|
|
||||||
def generatePage(title):
|
def generatePage(title, document):
|
||||||
#creates ./website-output/pagetitle/index.html file if it is not homepage
|
#creates ./website-output/pagetitle/index.html file if it is not homepage
|
||||||
foldername = ""
|
foldername = ""
|
||||||
|
|
||||||
@ -59,5 +58,5 @@ for file in os.listdir("./"):
|
|||||||
if file.endswith(".page"):
|
if file.endswith(".page"):
|
||||||
with open(file, 'r') as page:
|
with open(file, 'r') as page:
|
||||||
generateLines(os.path.basename(file), page.readlines())
|
generateLines(os.path.basename(file), page.readlines())
|
||||||
pagescount=pagescount+1
|
pagescount=pagescount+1
|
||||||
print("Generated " + str(pagescount) + " pages")
|
print("Generated " + str(pagescount) + " pages")
|
||||||
|
Loading…
Reference in New Issue
Block a user