Merge pull request #5851 from cocodrips/5841-apidoc-extensions

Fix #5841: Add --extensions option to sphinx-apidoc.
This commit is contained in:
Takeshi KOMIYA 2018-12-26 12:24:00 +09:00 committed by GitHub
commit 4f37b3342a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -137,7 +137,7 @@ Features added
are now generated with their own specific CSS classes
(``added``, ``changed`` and ``deprecated``, respectively) in addition to the
generic ``versionmodified`` class.
* #5841: apidoc: Add --extensions option to sphinx-apidoc
Bugs fixed
----------

View File

@ -371,6 +371,8 @@ Note: By default this script will not overwrite already created files."""))
'defaults to --doc-version'))
group = parser.add_argument_group(__('extension options'))
group.add_argument('--extensions', metavar='EXTENSIONS', dest='extensions',
action='append', help=__('enable arbitrary extensions'))
for ext in EXTENSIONS:
group.add_argument('--ext-%s' % ext, action='append_const',
const='sphinx.ext.%s' % ext, dest='extensions',
@ -439,6 +441,11 @@ def main(argv=sys.argv[1:]):
if args.extensions:
d['extensions'].extend(args.extensions)
for ext in d['extensions'][:]:
if ',' in ext:
d['extensions'].remove(ext)
d['extensions'].extend(ext.split(','))
if not args.dryrun:
qs.generate(d, silent=True, overwrite=args.force)
elif args.tocfile: