readfile.py works now

This commit is contained in:
Amber 2022-03-02 21:59:46 -06:00
parent 1c5f97d4ce
commit a5850ba2ec
2 changed files with 16 additions and 14 deletions

21
main.py
View File

@ -2,29 +2,27 @@
import readFile
inFile = ""
outFile = ""
#outFile = outFile + ".html"
timeCreate = 0 #Do I want this to be a str?
timeMod = 0
sTitle = ""
m2h = "" # markdown 2 html
def printHtml():
def printHtml(body):
print("placeholder")
file = open(outFile, 'w')
file.write(str(body))
file.close()
def parseMd(title, inFile):
print("probably not gonna use")
def parseMd(inFile):
m2h = readFile.readMarkdown(inFile)
return(m2h)
def metadata():
print("placeholder")
def css():
print("placeholder")
@ -32,6 +30,7 @@ def main():
print("placeholder")
def test():
print(readFile.readMarkdown("/home/amber/website.sh/sample.md"))
#print(readFile.readMarkdown("/home/amber/website.sh/sample.md"))
print(parseMd("sample.md"))
#test()
test()

View File

@ -8,7 +8,7 @@ class readMarkdown():
mdFile = ""
def __init__(self, mdFile):
outStr = ""
self.outStr = ""
self.mdFile = mdFile
@ -17,10 +17,13 @@ class readMarkdown():
file = open(mdFile, 'r')
#middleVar = file.read()
outStr = str(markdown.markdown(file.read()))
self.outStr = str(markdown.markdown(file.read()))
file.close()
return(self.outStr)
def __str__(self):
return(str(outStr))
return(str(self.markdown(self.mdFile)))
# might want to find a way to diff html from a file and readMarkdown()'s output if I want to update pages
# Edit: just keep the original markdown files dumbass