diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-01-12 23:42:56 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-12 23:42:56 +0900 |
commit | 81a4248df90be6075aba8fa65dd1cd13b67fd3d4 (patch) | |
tree | 1b0819f144ea07a473ce2f6ced6a6c0af94a6d5b /sphinx/apidoc.py | |
parent | 3060456dbcf3af1c67a8c6a215efccd0c9c30bcc (diff) | |
parent | a2cddfeac990b0ab472b304f86a8986ec41c9019 (diff) | |
download | sphinx-git-81a4248df90be6075aba8fa65dd1cd13b67fd3d4.tar.gz |
Merge pull request #3323 from gbaier/apidoc_extensions
apidoc takes extension options
Diffstat (limited to 'sphinx/apidoc.py')
-rw-r--r-- | sphinx/apidoc.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py index 0fca17d81..11d2994ef 100644 --- a/sphinx/apidoc.py +++ b/sphinx/apidoc.py @@ -25,6 +25,7 @@ from fnmatch import fnmatch from sphinx.util.osutil import FileAvoidWrite, walk from sphinx import __display_version__ +from sphinx.quickstart import EXTENSIONS if False: # For type annotation @@ -346,6 +347,11 @@ Note: By default this script will not overwrite already created files.""") 'defaults to --doc-version') parser.add_option('--version', action='store_true', dest='show_version', help='Show version information and exit') + group = parser.add_option_group('Extension options') + for ext in EXTENSIONS: + group.add_option('--ext-' + ext, action='store_true', + dest='ext_' + ext, default=False, + help='enable %s extension' % ext) (opts, args) = parser.parse_args(argv[1:]) @@ -404,6 +410,10 @@ Note: By default this script will not overwrite already created files.""") module_path = rootpath, append_syspath = opts.append_syspath, ) + enabled_exts = {'ext_' + ext: getattr(opts, 'ext_' + ext) + for ext in EXTENSIONS if getattr(opts, 'ext_' + ext)} + d.update(enabled_exts) + if isinstance(opts.header, binary_type): d['project'] = d['project'].decode('utf-8') if isinstance(opts.author, binary_type): |