mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merged in westurner/sphinx/apidoc_output_order (pull request #236)
#1456: apidoc: Add a -M option to put module documentation before submodule documentation
This commit is contained in:
commit
d50feaaec3
@ -96,6 +96,9 @@ def create_package_file(root, master_package, subroot, py_files, opts, subs):
|
|||||||
"""Build the text of the file and write the file."""
|
"""Build the text of the file and write the file."""
|
||||||
text = format_heading(1, '%s package' % makename(master_package, subroot))
|
text = format_heading(1, '%s package' % makename(master_package, subroot))
|
||||||
|
|
||||||
|
if opts.modulefirst:
|
||||||
|
text += format_directive(subroot, master_package)
|
||||||
|
|
||||||
# build a list of directories that are szvpackages (contain an INITPY file)
|
# build a list of directories that are szvpackages (contain an INITPY file)
|
||||||
subs = [sub for sub in subs if path.isfile(path.join(root, sub, INITPY))]
|
subs = [sub for sub in subs if path.isfile(path.join(root, sub, INITPY))]
|
||||||
# if there are some package directories, add a TOC for theses subpackages
|
# if there are some package directories, add a TOC for theses subpackages
|
||||||
@ -135,6 +138,7 @@ def create_package_file(root, master_package, subroot, py_files, opts, subs):
|
|||||||
text += '\n'
|
text += '\n'
|
||||||
text += '\n'
|
text += '\n'
|
||||||
|
|
||||||
|
if not opts.modulefirst:
|
||||||
text += format_heading(2, 'Module contents')
|
text += format_heading(2, 'Module contents')
|
||||||
text += format_directive(subroot, master_package)
|
text += format_directive(subroot, master_package)
|
||||||
|
|
||||||
@ -288,6 +292,10 @@ Note: By default this script will not overwrite already created files.""")
|
|||||||
help='Don\'t create headings for the module/package '
|
help='Don\'t create headings for the module/package '
|
||||||
'packages (e.g. when the docstrings already contain '
|
'packages (e.g. when the docstrings already contain '
|
||||||
'them)')
|
'them)')
|
||||||
|
parser.add_option('-M', '--module-first', action='store_true',
|
||||||
|
dest='modulefirst',
|
||||||
|
help='Put module documentation before submodule '
|
||||||
|
'documentation')
|
||||||
parser.add_option('-s', '--suffix', action='store', dest='suffix',
|
parser.add_option('-s', '--suffix', action='store', dest='suffix',
|
||||||
help='file suffix (default: rst)', default='rst')
|
help='file suffix (default: rst)', default='rst')
|
||||||
parser.add_option('-F', '--full', action='store_true', dest='full',
|
parser.add_option('-F', '--full', action='store_true', dest='full',
|
||||||
|
Loading…
Reference in New Issue
Block a user