html.xonsh/main.py

34 lines
686 B
Python
Raw Permalink Normal View History

#!/usr/bin/python
2022-03-03 02:00:20 +00:00
import readFile
import datetime
import header
2022-03-03 00:41:53 +00:00
2022-03-03 02:00:20 +00:00
#outFile = outFile + ".html"
2022-03-03 03:59:46 +00:00
m2h = "" # markdown 2 html
footStr = "\n</body>\n</html>"
2022-03-03 00:41:53 +00:00
2022-03-04 02:40:32 +00:00
def printHtml(head, body, foot, outFile):
2022-03-03 02:00:20 +00:00
file = open(outFile, 'w')
file.write(head + body + foot)
2022-03-03 02:00:20 +00:00
2022-03-03 03:59:46 +00:00
file.close()
2022-03-03 00:41:53 +00:00
2022-03-03 03:59:46 +00:00
def parseMd(inFile):
2022-03-04 02:40:32 +00:00
global m2h
m2h = str(readFile.readMarkdown(inFile))
2022-03-03 03:59:46 +00:00
return(m2h)
2022-03-03 00:41:53 +00:00
def main():
2022-03-05 07:04:26 +00:00
# metadata("sample.md")
2022-03-04 02:40:32 +00:00
parseMd("sample.md")
2022-03-09 03:39:44 +00:00
humanReadableArg = str(header.readHead("Big Grand Tigle"))
printHtml(humanReadableArg, m2h, footStr, "outdir/index.html")
2022-03-04 02:40:32 +00:00
2022-03-03 02:40:58 +00:00
def test():
print(str(header.readHead("string")) + str(parseMd("sample.md")) + footStr)
2022-03-09 03:39:44 +00:00
main()
#test()