Skip to content

Commit 0a82948

Browse files
committed
fix: auto package uses full module name
1 parent 661a84a commit 0a82948

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

quartodoc/builder/blueprint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ def _auto_package(mod: dc.Module) -> list[Section]:
5555
else:
5656
desc = ""
5757

58-
return [Section(title=mod.name, desc=desc, contents=contents)]
58+
return [Section(title=mod.path, desc=desc, contents=contents)]
5959

6060

6161
def _is_external_alias(obj: dc.Alias | dc.Object, mod: dc.Module):
62-
package_name = mod.name.split(".")[0]
62+
package_name = mod.path.split(".")[0]
6363

6464
if not isinstance(obj, dc.Alias):
6565
return False

quartodoc/tests/test_builder_blueprint.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,14 @@ def test_blueprint_lookup_error_message(bp):
106106
"Does an object with the path quartodoc.bbb.ccc exist?"
107107
in exc_info.value.args[0]
108108
)
109+
110+
111+
def test_blueprint_auto_package(bp):
112+
layout = blueprint(lo.Layout(package="quartodoc.tests.example"))
113+
sections = layout.sections
114+
assert len(sections) == 1
115+
assert sections[0].title == "quartodoc.tests.example"
116+
assert sections[0].desc == "A module"
117+
118+
# 4 objects documented
119+
assert len(sections[0].contents) == 4

0 commit comments

Comments
 (0)