Skip to content

Commit 92d4edc

Browse files
committed
Exclude %nodoc items from fallback sections
1 parent 9aeb32f commit 92d4edc

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

great_docs/core.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,14 +1495,16 @@ def _create_quartodoc_sections_from_families(self, package_name: str) -> list |
14951495
# Build family map: family_name -> list of items
14961496
family_map: dict[str, list[dict]] = {}
14971497
items_with_family: set[str] = set()
1498+
excluded_items: set[str] = set() # Track %nodoc items
14981499

14991500
# Process top-level exports
15001501
for item_name in exports:
15011502
directives = directive_map.get(item_name, DocDirectives())
15021503

1503-
# Skip items marked @nodoc
1504+
# Skip items marked %nodoc
15041505
if directives.nodoc:
1505-
print(f" Excluding '{item_name}' (@nodoc)")
1506+
print(f" Excluding '{item_name}' (%nodoc)")
1507+
excluded_items.add(item_name)
15061508
continue
15071509

15081510
if directives.family:
@@ -1525,14 +1527,15 @@ def _create_quartodoc_sections_from_families(self, package_name: str) -> list |
15251527
)
15261528
items_with_family.add(item_name)
15271529

1528-
# Process class methods that might have their own @family
1530+
# Process class methods that might have their own %family
15291531
for class_name in categories.get("classes", []):
15301532
method_names = categories.get("class_method_names", {}).get(class_name, [])
15311533
for method_name in method_names:
15321534
full_name = f"{class_name}.{method_name}"
15331535
directives = directive_map.get(full_name, DocDirectives())
15341536

15351537
if directives.nodoc:
1538+
excluded_items.add(full_name)
15361539
continue
15371540

15381541
if directives.family:
@@ -1602,14 +1605,20 @@ def family_sort_key(family_name: str) -> tuple:
16021605

16031606
print(f" {title}: {len(items)} item(s)")
16041607

1605-
# Add items without @family to fallback sections
1608+
# Add items without %family to fallback sections
1609+
# Exclude both items with families AND items marked %nodoc
16061610
unassigned_classes = [
1607-
c for c in categories.get("classes", []) if c not in items_with_family
1611+
c for c in categories.get("classes", [])
1612+
if c not in items_with_family and c not in excluded_items
16081613
]
16091614
unassigned_functions = [
1610-
f for f in categories.get("functions", []) if f not in items_with_family
1615+
f for f in categories.get("functions", [])
1616+
if f not in items_with_family and f not in excluded_items
1617+
]
1618+
unassigned_other = [
1619+
o for o in categories.get("other", [])
1620+
if o not in items_with_family and o not in excluded_items
16111621
]
1612-
unassigned_other = [o for o in categories.get("other", []) if o not in items_with_family]
16131622

16141623
if unassigned_classes:
16151624
class_contents = []

0 commit comments

Comments
 (0)