Merge pull request #5375 from tk0miya/5362_apidoc_toc

Fix #5362: apidoc: Add ``--toc`` option to change the filename of ToC
This commit is contained in:
Takeshi KOMIYA 2018-09-06 21:33:19 +09:00 committed by GitHub
commit dfbf90a128
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -21,6 +21,7 @@ Features added
-------------- --------------
* #5388: Ensure frozen object descriptions are reproducible * #5388: Ensure frozen object descriptions are reproducible
* #5362: apidoc: Add ``--tocfile`` option to change the filename of ToC
Bugs fixed Bugs fixed
---------- ----------

View File

@ -58,6 +58,10 @@ Options
Maximum depth for the generated table of contents file. Maximum depth for the generated table of contents file.
.. option:: --tocfile
Filename for a table of contents file. Defaults to ``modules``.
.. option:: -T, --no-toc .. option:: -T, --no-toc
Do not create a table of contents file. Ignored when :option:`--full` is Do not create a table of contents file. Ignored when :option:`--full` is

View File

@ -340,7 +340,9 @@ Note: By default this script will not overwrite already created files."""))
parser.add_argument('-P', '--private', action='store_true', parser.add_argument('-P', '--private', action='store_true',
dest='includeprivate', dest='includeprivate',
help=__('include "_private" modules')) help=__('include "_private" modules'))
parser.add_argument('-T', '--no-toc', action='store_true', dest='notoc', parser.add_argument('--tocfile', action='store', dest='tocfile', default='modules',
help=__("don't create a table of contents file"))
parser.add_argument('-T', '--no-toc', action='store_false', dest='tocfile',
help=__("don't create a table of contents file")) help=__("don't create a table of contents file"))
parser.add_argument('-E', '--no-headings', action='store_true', parser.add_argument('-E', '--no-headings', action='store_true',
dest='noheadings', dest='noheadings',
@ -453,8 +455,8 @@ def main(argv=sys.argv[1:]):
if not args.dryrun: if not args.dryrun:
qs.generate(d, silent=True, overwrite=args.force) qs.generate(d, silent=True, overwrite=args.force)
elif not args.notoc: elif args.tocfile:
create_modules_toc_file(modules, args) create_modules_toc_file(modules, args, args.tocfile)
return 0 return 0