Skip to content

Commit 7fb7518

Browse files
authored
Merge pull request #281 from machow/fix-signature-when-alias
Fix signature when alias
2 parents 9d8f53f + 785ef2e commit 7fb7518

File tree

7 files changed

+37
-4
lines changed

7 files changed

+37
-4
lines changed

quartodoc/renderers/md_renderer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def signature(self, el: layout.Doc):
163163
@dispatch
164164
def signature(self, el: dc.Alias, source: Optional[dc.Alias] = None):
165165
"""Return a string representation of an object's signature."""
166-
return self.signature(el.target, el)
166+
return self.signature(el.final_target, el)
167167

168168
@dispatch
169169
def signature(

quartodoc/tests/__snapshots__/test_renderers.ambr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,15 @@
268268
A function
269269
'''
270270
# ---
271+
# name: test_render_doc_signature_name_alias_of_alias
272+
'''
273+
# example.a_nested_alias { #quartodoc.tests.example.a_nested_alias }
274+
275+
`tests.example.a_nested_alias()`
276+
277+
A nested alias target
278+
'''
279+
# ---
271280
# name: test_render_docstring_numpy_linebreaks
272281
'''
273282
# f_numpy_with_linebreaks { #quartodoc.tests.example_docstring_styles.f_numpy_with_linebreaks }

quartodoc/tests/example.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
# flake8: noqa
44

5-
from quartodoc.tests.example_alias_target import alias_target as a_alias
5+
from quartodoc.tests.example_alias_target import (
6+
alias_target as a_alias,
7+
nested_alias_target as a_nested_alias,
8+
)
69

710

811
def a_func():
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1+
from quartodoc.tests.example_alias_target__nested import ( # noqa: F401
2+
nested_alias_target,
3+
)
4+
5+
16
def alias_target():
27
"""An alias target"""
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
This function gets imported in example_alias_target, and from there imported into example.
3+
"""
4+
5+
6+
def nested_alias_target():
7+
"""A nested alias target"""

quartodoc/tests/test_builder_blueprint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ def test_blueprint_auto_package(bp):
133133
assert sections[0].title == "quartodoc.tests.example"
134134
assert sections[0].desc == "A module"
135135

136-
# 4 objects documented
137-
assert len(sections[0].contents) == 4
136+
# 5 objects documented
137+
assert len(sections[0].contents) == 5
138138

139139

140140
def test_blueprint_layout_options():

quartodoc/tests/test_renderers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,12 @@ def test_render_doc_signature_name(snapshot, renderer):
164164
res = renderer.render(bp)
165165

166166
assert res == snapshot
167+
168+
169+
def test_render_doc_signature_name_alias_of_alias(snapshot, renderer):
170+
auto = Auto(name="example.a_nested_alias", package="quartodoc.tests")
171+
bp = blueprint(auto)
172+
173+
res = renderer.render(bp)
174+
175+
assert res == snapshot

0 commit comments

Comments
 (0)