1
0
flewkey.com/scripts/template_md.py

17 lines
481 B
Python
Raw Normal View History

2020-07-12 22:35:49 -04:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import markdown
from template import template
def main():
md = markdown.Markdown(extensions = ["meta", "extra"])
with open(sys.argv[1], "r", encoding="utf-8") as file_in:
html = md.convert(file_in.read())
output = template(html, sys.argv[2], ".html", md.Meta) if "template" in md.Meta else html
with open(sys.argv[2], "w+", encoding="utf-8") as file_out:
file_out.write(output)
if __name__ == "__main__":
main()