From 1e02f03a0fd31da246e5ad2524b51e3bc5694e5e Mon Sep 17 00:00:00 2001 From: Govindas Date: Sat, 22 Jan 2022 16:27:49 +0200 Subject: [PATCH] document does not need to be global --- generate.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/generate.py b/generate.py index cc9a1c6..6b83613 100644 --- a/generate.py +++ b/generate.py @@ -25,16 +25,15 @@ def generateNavigationBar(lines): navbar = navbar.li(HTML("" + title + "")) def generateLines(title, lines): - global document title = title.replace(".page", "") document = Document(title, lang="en") for line in lines: 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 foldername = "" @@ -59,5 +58,5 @@ for file in os.listdir("./"): if file.endswith(".page"): with open(file, 'r') as page: generateLines(os.path.basename(file), page.readlines()) - pagescount=pagescount+1 + pagescount=pagescount+1 print("Generated " + str(pagescount) + " pages")