diff options
author | Ross Barnowski <rossbar@berkeley.edu> | 2020-08-17 16:41:30 -0700 |
---|---|---|
committer | Ross Barnowski <rossbar@berkeley.edu> | 2020-08-17 16:41:30 -0700 |
commit | bd40a0da894c928be8cdb91d55b1b3fa3dec6f71 (patch) | |
tree | 71cd124dc263ca2078b3170996f17e19ae380802 | |
parent | e8f237ec2b5ace76da2e0bbf62a7cffb1a637422 (diff) | |
download | numpydoc-bd40a0da894c928be8cdb91d55b1b3fa3dec6f71.tar.gz |
Add config value to control behavior
-rw-r--r-- | numpydoc/docscrape_sphinx.py | 9 | ||||
-rw-r--r-- | numpydoc/numpydoc.py | 2 | ||||
-rw-r--r-- | numpydoc/tests/test_numpydoc.py | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/numpydoc/docscrape_sphinx.py b/numpydoc/docscrape_sphinx.py index ebc828f..301556f 100644 --- a/numpydoc/docscrape_sphinx.py +++ b/numpydoc/docscrape_sphinx.py @@ -30,6 +30,7 @@ class SphinxDocString(NumpyDocString): self.xref_param_type = config.get('xref_param_type', False) self.xref_aliases = config.get('xref_aliases', dict()) self.xref_ignore = config.get('xref_ignore', set()) + self.xref_wrap_all = config.get('xref_wrap_all', True) self.template = config.get('template', None) if self.template is None: template_dirs = [os.path.join(os.path.dirname(__file__), 'templates')] @@ -77,7 +78,9 @@ class SphinxDocString(NumpyDocString): param_type = make_xref( param_type, self.xref_aliases, - self.xref_ignore) + self.xref_ignore, + self.xref_wrap_all + ) if param.name: out += self._str_indent([named_fmt % (param.name.strip(), param_type)]) @@ -217,7 +220,9 @@ class SphinxDocString(NumpyDocString): param_type = make_xref( param_type, self.xref_aliases, - self.xref_ignore) + self.xref_ignore, + self.xref_wrap_all + ) parts.append(param_type) out += self._str_indent([' : '.join(parts)]) diff --git a/numpydoc/numpydoc.py b/numpydoc/numpydoc.py index 93cd975..8a6072f 100644 --- a/numpydoc/numpydoc.py +++ b/numpydoc/numpydoc.py @@ -155,6 +155,7 @@ def mangle_docstrings(app, what, name, obj, options, lines): 'xref_param_type': app.config.numpydoc_xref_param_type, 'xref_aliases': app.config.numpydoc_xref_aliases_complete, 'xref_ignore': app.config.numpydoc_xref_ignore, + 'xref_wrap_all': app.config.numpydoc_xref_wrap_all, } cfg.update(options or {}) @@ -254,6 +255,7 @@ def setup(app, get_doc_object_=get_doc_object): app.add_config_value('numpydoc_xref_param_type', False, True) app.add_config_value('numpydoc_xref_aliases', dict(), True) app.add_config_value('numpydoc_xref_ignore', set(), True) + app.add_config_value('numpydoc_xref_wrap_all', True, True) # Extra mangling domains app.add_domain(NumpyPythonDomain) diff --git a/numpydoc/tests/test_numpydoc.py b/numpydoc/tests/test_numpydoc.py index 77e7540..35899bd 100644 --- a/numpydoc/tests/test_numpydoc.py +++ b/numpydoc/tests/test_numpydoc.py @@ -15,6 +15,7 @@ class MockConfig(): numpydoc_xref_aliases = {} numpydoc_xref_aliases_complete = deepcopy(DEFAULT_LINKS) numpydoc_xref_ignore = set() + numpydoc_xref_wrap_all = True templates_path = [] numpydoc_edit_link = False numpydoc_citation_re = '[a-z0-9_.-]+' |