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