blob: b4e213c81d7804c4874ac63d1b1e09a0db8f786f (
plain)
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
30
31
32
33
|
import os
import markdown
def convertDir( source , dest ):
if not os.path.exists( dest ):
os.mkdir( dest )
for x in os.listdir( source + "/" ):
if not x.endswith( ".md" ):
continue
f = open( source + "/" + x , 'r' )
raw = f.read()
f.close()
html = markdown.markdown( raw )
print( x )
o = open( dest + "/" + x.replace( ".md" , ".html" ) , 'w' )
o.write( html )
o.close()
def convertMain():
convertDir( "docs" , "docs/html" )
if __name__ == "__main__":
convertMain()
|