Skip to content

Commit 80e0d42

Browse files
committed
revert this; instead, take off __init__ up front
1 parent 0c0031e commit 80e0d42

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

sphinx_paramlinks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '0.2.1'
1+
__version__ = '0.2.2'
22

33
from .sphinx_paramlinks import setup

sphinx_paramlinks/sphinx_paramlinks.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ def autodoc_process_docstring(app, what, name, obj, options, lines):
1515
# name with that of the parent object name plus a token we can
1616
# spot later.
1717
def _cvt_param(name, line):
18+
if name.endswith(".__init__"):
19+
# kill off __init__ if present, the links are always
20+
# off the class
21+
name = name[0:-9]
1822
def cvt(m):
1923
return ":param %s_sphinx_paramlinks_%s.%s:" % (
2024
m.group(1) or '', name, m.group(2))
@@ -126,20 +130,8 @@ def lookup_params(app, env, node, contnode):
126130
# along with the classname/methodname/funcname minus the parameter
127131
# part.
128132

129-
# see if this is a class constructor first...
130133
newnode = domain.resolve_xref(env, refdoc, app.builder,
131-
"class", resolve_target, node, contnode)
132-
if newnode:
133-
# if yes, see if the __init__ is documented explicitly
134-
methnode = domain.resolve_xref(env, refdoc, app.builder,
135-
"meth", resolve_target + ".__init__", node, contnode)
136-
if methnode:
137-
newnode = methnode
138-
139-
else:
140-
# if no, just look up based on "obj"
141-
newnode = domain.resolve_xref(env, refdoc, app.builder,
142-
"obj", resolve_target, node, contnode)
134+
"obj", resolve_target, node, contnode)
143135

144136
if newnode is not None:
145137
# assuming we found it, tack the paramname back onto to the final

0 commit comments

Comments
 (0)