Skip to content

Commit 9f571e8

Browse files
committed
multiline docstring handling
1 parent 79f4663 commit 9f571e8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

examples/document.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class Paragraph(Base):
2121
@modelspec.define
2222
class Section(Base):
2323
"""
24-
A model of a section of the :class:`Document`. Will contain one :class:`Paragraph` or more
24+
A model of a section of the :class:`Document`.
25+
Will contain one :class:`Paragraph` or more.
2526
2627
Args:
2728
id: The id of the section

src/modelspec/base_types.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,11 @@ def _parse_definition(cls) -> str:
373373
p = parse(cls.__doc__)
374374

375375
# Extract the description, use the long description if available.
376-
return p.long_description if p.long_description else p.short_description
376+
if p.long_description:
377+
definition = p.short_description + p.long_description
378+
else:
379+
definition = p.short_description
380+
return definition
377381

378382
@classmethod
379383
def _parse_allowed_fields(cls) -> Dict[str, Tuple[str, Any]]:

0 commit comments

Comments
 (0)