mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5851 from cocodrips/5841-apidoc-extensions
Fix #5841: Add --extensions option to sphinx-apidoc.
This commit is contained in:
commit
4f37b3342a
2
CHANGES
2
CHANGES
@ -137,7 +137,7 @@ Features added
|
|||||||
are now generated with their own specific CSS classes
|
are now generated with their own specific CSS classes
|
||||||
(``added``, ``changed`` and ``deprecated``, respectively) in addition to the
|
(``added``, ``changed`` and ``deprecated``, respectively) in addition to the
|
||||||
generic ``versionmodified`` class.
|
generic ``versionmodified`` class.
|
||||||
|
* #5841: apidoc: Add --extensions option to sphinx-apidoc
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -371,6 +371,8 @@ Note: By default this script will not overwrite already created files."""))
|
|||||||
'defaults to --doc-version'))
|
'defaults to --doc-version'))
|
||||||
|
|
||||||
group = parser.add_argument_group(__('extension options'))
|
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:
|
for ext in EXTENSIONS:
|
||||||
group.add_argument('--ext-%s' % ext, action='append_const',
|
group.add_argument('--ext-%s' % ext, action='append_const',
|
||||||
const='sphinx.ext.%s' % ext, dest='extensions',
|
const='sphinx.ext.%s' % ext, dest='extensions',
|
||||||
@ -439,6 +441,11 @@ def main(argv=sys.argv[1:]):
|
|||||||
if args.extensions:
|
if args.extensions:
|
||||||
d['extensions'].extend(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:
|
if not args.dryrun:
|
||||||
qs.generate(d, silent=True, overwrite=args.force)
|
qs.generate(d, silent=True, overwrite=args.force)
|
||||||
elif args.tocfile:
|
elif args.tocfile:
|
||||||
|
Loading…
Reference in New Issue
Block a user