Skip to content

Commit 671cf1f

Browse files
authored
Merge pull request #180 from machow/feat-canonical-collect
Feat canonical collect
2 parents 9174003 + 039a2b5 commit 671cf1f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

quartodoc/builder/collect.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,25 @@ def exit(self, el: layout.Doc):
3939
p_el = page_node.value
4040

4141
uri = f"{self.base_dir}/{p_el.path}.html#{el.anchor}"
42+
43+
name_path = el.obj.path
44+
canonical_path = el.obj.canonical_path
45+
46+
# item corresponding to the specified path ----
47+
# e.g. this might be a top-level import
4248
self.items.append(
43-
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)
4450
)
4551

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+
)
60+
4661
return el
4762

4863
@dispatch

0 commit comments

Comments
 (0)