Skip to content

Commit 98d76e1

Browse files
authored
Merge pull request #218 from machow/feat-undoc-empty
Feat undoc empty
2 parents ca63da8 + 27a1ff8 commit 98d76e1

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

quartodoc/builder/blueprint.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ def _fetch_members(el: Auto, obj: dc.Object | dc.Alias):
292292
if not el.include_imports:
293293
options = {k: v for k, v in options.items() if not v.is_alias}
294294

295+
if not el.include_empty:
296+
options = {k: v for k, v in options.items() if v.docstring is not None}
297+
295298
# for modules, remove any Alias objects, since they were imported from
296299
# other places. Sphinx has a flag for this behavior, so may be good
297300
# to do something similar.

quartodoc/layout.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ class Auto(_Base):
198198
Whether to include members starting with "_"
199199
include_imports:
200200
Whether to include members that were imported from somewhere else.
201+
include_empty:
202+
Whether to include members with no docstring.
201203
include:
202204
(Not implemented). A list of members to include.
203205
exclude:
@@ -219,6 +221,7 @@ class Auto(_Base):
219221
members: Optional[list[str]] = None
220222
include_private: bool = False
221223
include_imports: bool = False
224+
include_empty: bool = False
222225
include: Optional[str] = None
223226
exclude: Optional[str] = None
224227
dynamic: Union[None, bool, str] = None

quartodoc/tests/__snapshots__/test_renderers.ambr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
| --- | --- |
2424
| [SOME_ATTRIBUTE](#quartodoc.tests.example_class.C.SOME_ATTRIBUTE) | An attribute |
2525
| [some_property](#quartodoc.tests.example_class.C.some_property) | A property |
26-
| [x](#quartodoc.tests.example_class.C.x) | |
27-
| [y](#quartodoc.tests.example_class.C.y) | |
28-
| [z](#quartodoc.tests.example_class.C.z) | |
26+
| [z](#quartodoc.tests.example_class.C.z) | A documented init attribute |
2927

3028
## Methods
3129

@@ -64,9 +62,7 @@
6462
| --- | --- |
6563
| [SOME_ATTRIBUTE](#quartodoc.tests.example_class.C.SOME_ATTRIBUTE) | An attribute |
6664
| [some_property](#quartodoc.tests.example_class.C.some_property) | A property |
67-
| [x](#quartodoc.tests.example_class.C.x) | |
68-
| [y](#quartodoc.tests.example_class.C.y) | |
69-
| [z](#quartodoc.tests.example_class.C.z) | |
65+
| [z](#quartodoc.tests.example_class.C.z) | A documented init attribute |
7066

7167
## Methods
7268

@@ -116,12 +112,14 @@
116112

117113
| Name | Description |
118114
| --- | --- |
119-
| [AClass](#quartodoc.tests.example.AClass) | |
115+
| [AClass](#quartodoc.tests.example.AClass) | A class |
120116

121117
### AClass { #quartodoc.tests.example.AClass }
122118

123119
`tests.example.AClass()`
124120

121+
A class
122+
125123
#### Attributes
126124

127125
| Name | Description |
@@ -171,12 +169,14 @@
171169

172170
| Name | Description |
173171
| --- | --- |
174-
| [AClass](#quartodoc.tests.example.AClass) | |
172+
| [AClass](#quartodoc.tests.example.AClass) | A class |
175173

176174
## AClass { #quartodoc.tests.example.AClass }
177175

178176
`tests.example.AClass()`
179177

178+
A class
179+
180180
### Attributes
181181

182182
| Name | Description |

quartodoc/tests/example.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ def a_func():
1414

1515

1616
class AClass:
17+
"""A class"""
18+
1719
a_attr = 1
1820
"""A class attribute"""
1921

quartodoc/tests/example_class.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def __init__(self, x: str, y: int):
2020
self.x = x
2121
self.y = y
2222
self.z: int = 1
23+
"""A documented init attribute"""
2324

2425
def some_method(self):
2526
"""A method"""

0 commit comments

Comments
 (0)