summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Bussonnier <bussonniermatthias@gmail.com>2020-07-12 18:19:35 -0700
committerEric Larson <larson.eric.d@gmail.com>2020-07-13 09:25:44 -0400
commita82926f8beef43cd1eca937ea77f5d158ccf7915 (patch)
tree8129c3b4e560feaba41b8dbd6470c65bc5005c3f
parent4e7c5ad998de88cea965dbfb5c86da5dffb0f806 (diff)
downloadnumpydoc-a82926f8beef43cd1eca937ea77f5d158ccf7915.tar.gz
BUG: fix role regex.
Spyder sometime uses the full :py:meth: role, this make sure it is properly handled.
-rw-r--r--numpydoc/docscrape.py2
-rw-r--r--numpydoc/tests/test_docscrape.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py
index 807e9bc..0ee979e 100644
--- a/numpydoc/docscrape.py
+++ b/numpydoc/docscrape.py
@@ -251,7 +251,7 @@ class NumpyDocString(Mapping):
# Examples: func_f1 :meth:`func_h1` :obj:`~baz.obj_r` :class:`class_j`
# <DESC> is a string describing the function.
- _role = r":(?P<role>\w+):"
+ _role = r":(?P<role>(py:)?\w+):"
_funcbacktick = r"`(?P<name>(?:~\w+\.)?[a-zA-Z0-9_\.-]+)`"
_funcplain = r"(?P<name2>[a-zA-Z0-9_\.-]+)"
_funcname = r"(" + _role + _funcbacktick + r"|" + _funcplain + r")"
diff --git a/numpydoc/tests/test_docscrape.py b/numpydoc/tests/test_docscrape.py
index f74a2a5..ff0fe0a 100644
--- a/numpydoc/tests/test_docscrape.py
+++ b/numpydoc/tests/test_docscrape.py
@@ -110,6 +110,7 @@ doc_txt = '''\
--------
some, other, funcs
otherfunc : relationship
+ :py:meth:`spyder.widgets.mixins.GetHelpMixin.show_object_info`
Examples
--------
@@ -435,6 +436,8 @@ See Also
..
`otherfunc`_
relationship
+:py:meth:`spyder.widgets.mixins.GetHelpMixin.show_object_info`
+ ..
Notes
-----
@@ -602,6 +605,8 @@ of the one-dimensional normal distribution to higher dimensions.
..
:obj:`otherfunc`
relationship
+ :py:meth:`spyder.widgets.mixins.GetHelpMixin.show_object_info`
+ ..
.. rubric:: Notes