File tree Expand file tree Collapse file tree 4 files changed +39
-0
lines changed
src/sphinx_codeautolink/extension Expand file tree Collapse file tree 4 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ These release notes are based on
88sphinx-codeautolink adheres to
99`Semantic Versioning <https://semver.org >`_.
1010
11+ Unreleased
12+ ----------
13+ - Add ability to link to subclass documentation (:issue: `68 `)
14+
11150.6.0 (2021-11-21)
1216------------------
1317- Remove text decoration from produced links (:issue: `3 `)
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ def locate_type(
3131 remaining = components [index :]
3232 location = '.' .join (components [:index ])
3333
34+ prev_val = None
3435 for component in remaining :
3536 value = getattr (value , component , None )
3637 location += '.' + component
@@ -44,6 +45,14 @@ def locate_type(
4445 # Odd construct encountered: don't try to be clever but continue
4546 pass
4647
48+ if isinstance (prev_val , type ) and location not in inventory :
49+ for val in prev_val .mro ():
50+ loc = fully_qualified_name (val ) + '.' + component
51+ if loc in inventory :
52+ return locate_type (tuple (loc .split ('.' )), inventory , ends_with_call )
53+
54+ prev_val = value
55+
4756 # A possible function / method call needs to be last in the chain.
4857 # Otherwise we might follow return types on function attribute access.
4958 if (
Original file line number Diff line number Diff line change 1+ test_project
2+ test_project.Child.meth
3+ test_project.Child
4+ meth
5+ test_project.Child.attr
6+ test_project.Child
7+ attr
8+ # split
9+ # split
10+ Test project
11+ ============
12+
13+ .. code:: python
14+
15+ import test_project
16+ test_project.Child.meth()
17+ test_project.Child().meth()
18+ test_project.Child.attr
19+ test_project.Child().attr
20+
21+ .. automodule:: test_project
22+ :no-inherited-members:
Original file line number Diff line number Diff line change @@ -33,3 +33,7 @@ def optional() -> Optional[Foo]:
3333
3434def compile ():
3535 """Shadows built in compile function."""
36+
37+
38+ class Child (Foo ):
39+ """Foo child class."""
You can’t perform that action at this time.
0 commit comments