def generate_rest_files(module,path='source'):
import fandango
print '\n'*5
print 'Writing documentation settings to %s/*rst' % (path)
if fandango.isString(module): module = fandango.loadModule(module)
submodules = [(o,v) for o,v in vars(module).items()
if inspect.ismodule(v) and v.__name__.startswith(module.__name__)]
for o,v in submodules:
filename = path+'/'+o+'.rst'
if not os.path.isfile(filename):
print('writing %s'%filename)
open(filename,'w').write(DEFAULT_MODULE%(v.__name__,'='*len(v.__name__),v.__name__))
print('\nWrite this into index.rst:\n')
print("""
.. toctree::
:maxdepth: 2
"""+
'\n '.join([t[0] for t in submodules]))
评论列表
文章目录