Skip to content

Commit 039a2b5

Browse files
committed
fix: canonical path item now has dispname set
1 parent 112c520 commit 039a2b5

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

quartodoc/builder/collect.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,23 @@ def exit(self, el: layout.Doc):
4040

4141
uri = f"{self.base_dir}/{p_el.path}.html#{el.anchor}"
4242

43+
name_path = el.obj.path
44+
canonical_path = el.obj.canonical_path
45+
4346
# item corresponding to the specified path ----
4447
# e.g. this might be a top-level import
4548
self.items.append(
46-
layout.Item(name=el.obj.path, obj=el.obj, uri=uri, dispname=None)
49+
layout.Item(name=name_path, obj=el.obj, uri=uri, dispname=None)
4750
)
4851

49-
# item corresponding to the canonical path ----
50-
# this is where the object is defined (which may be deep in a submodule)
51-
self.items.append(
52-
layout.Item(name=el.obj.canonical_path, obj=el.obj, uri=uri, dispname=None)
53-
)
52+
if name_path != canonical_path:
53+
# item corresponding to the canonical path ----
54+
# this is where the object is defined (which may be deep in a submodule)
55+
self.items.append(
56+
layout.Item(
57+
name=canonical_path, obj=el.obj, uri=uri, dispname=name_path
58+
)
59+
)
5460

5561
return el
5662

0 commit comments

Comments
 (0)