diff options
Diffstat (limited to 'doc/build/genhtml.py')
-rw-r--r-- | doc/build/genhtml.py | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/doc/build/genhtml.py b/doc/build/genhtml.py index 2a274b03a..015f65bdf 100644 --- a/doc/build/genhtml.py +++ b/doc/build/genhtml.py @@ -1,24 +1,65 @@ #!/usr/bin/env python -import sys,re,os +import sys,re,os,shutil +import myghty.interp +import myghty.exception as exception +import cPickle as pickle -print "Running txt2myt.py..." -execfile("txt2myt.py") +sys.path = ['../../lib', './lib/'] + sys.path -print "Generating docstring data" -execfile("compile_docstrings.py") +import gen_docstrings, read_markdown, toc + +files = [ + 'index', + 'tutorial', + 'dbengine', + 'metadata', + 'sqlconstruction', + 'datamapping', + 'unitofwork', + 'adv_datamapping', + 'types', + 'pooling', + 'plugins', + 'docstrings' + ] + +title='SQLAlchemy 0.3 Documentation' +version = '0.3.0' + +root = toc.TOCElement('', 'root', '', version=version, doctitle=title) + +shutil.copy('./content/index.myt', './output/index.myt') +shutil.copy('./content/docstrings.myt', './output/docstrings.myt') + +read_markdown.parse_markdown_files(root, files) +docstrings = gen_docstrings.make_all_docs() +gen_docstrings.create_docstring_toc(docstrings, root) + +pickle.dump(docstrings, file('./output/compiled_docstrings.pickle', 'w')) +pickle.dump(root, file('./output/table_of_contents.pickle', 'w')) component_root = [ {'components': './components'}, - {'content' : './content'} + {'output' :'./output'} ] -doccomp = ['document_base.myt'] output = os.path.dirname(os.getcwd()) -sys.path = ['./lib/'] + sys.path +interp = myghty.interp.Interpreter(component_root = component_root, output_encoding='utf-8') -import documentgen +def genfile(name, toc): + infile = name + ".myt" + outname = os.path.join(os.getcwd(), '../', name + ".html") + outfile = file(outname, 'w') + print infile, '->', outname + interp.execute(infile, out_buffer=outfile, request_args={'toc':toc,'extension':'html'}, raise_error=True) + +try: + for filename in files: + genfile(filename, root) +except exception.Error, e: + sys.stderr.write(e.textformat()) -documentgen.genall(doccomp, component_root, output) + |