summaryrefslogtreecommitdiff
path: root/src/md.py
blob: d07df0f62f52a36d1d1b3d5485503be52e62103a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python2
import os
import os.path
import sys

from jinja2 import Environment, PackageLoader, Template, FileSystemLoader

import mistune

#check if there is input file
if len(sys.argv) < 2:
	print "Need more arguments"
	sys.exit(0)

md_fn = sys.argv[1]

#template loader
loader = FileSystemLoader( "/home/fam/prog/python/mdsite/templ/" )
templ_env = Environment( loader = loader )

t = templ_env.get_template("main.thtml")

#get md file
f = open( md_fn, "r" )
data = f.read()
md = mistune.Markdown(rule=True)
md_rend = md.render( data )

print t.render( block = md_rend )