summaryrefslogtreecommitdiff
path: root/sandbox/gschwant/docfactory/createdoc.py
blob: 6f57dec48b793b1929fe82fef6d811c6475c0530 (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
#!/usr/bin/env python

"""
:author:  Dr. Gunnar Schwant
:contact: g.schwant@gmx.de
:version: 0.2.1
"""

import glob, os, webbrowser
from docutils.core import publish_cmdline

def convert():
    for file in glob.glob('*.txt'):
        htmlfile = '%s.html' % os.path.splitext(file)[0]
        print '%s --> %s' % (file, htmlfile)
        publish_cmdline(writer_name='html',
                        argv = [file, htmlfile])

if __name__=='__main__':
    print '\nGenerating HTML ...\n'
    convert()
    os.chdir('doc')
    convert()
    print '\nOpen doc/index.html with default webbrowser ...\n'
    webbrowser.open('index.html')