17 lines
481 B
Python
17 lines
481 B
Python
|
#!/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()
|