html.xonsh/readFile.py

27 lines
630 B
Python
Executable File

#!/usr/bin/python
import markdown
# Only do the <body> tag
class readMarkdown():
outStr = ""
mdFile = ""
def __init__(self, mdFile):
self.outStr = ""
self.mdFile = mdFile
def markdown(self):
file = open(self.mdFile, 'r')
outStr = str(markdown.markdown(file.read())) #TODO: I really want nice tab indentations
file.close()
return(outStr)
def __str__(self):
return(str(self.markdown()))
# 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