Skip to content

Commit

Permalink
🐛 Fix need_part with multi-line content (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored Sep 12, 2024
1 parent ea21267 commit b3d65c8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sphinx_needs/roles/need_part.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def process_need_part(
pass


part_pattern = re.compile(r"\(([\w-]+)\)(.*)")
part_pattern = re.compile(r"\(([\w-]+)\)(.*)", re.DOTALL)


def iter_need_parts(need: NeedsInfoType) -> Iterable[NeedsInfoType]:
Expand Down
13 changes: 13 additions & 0 deletions tests/__snapshots__/test_need_parts.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* :need_part:`(1)exit()`
* :need_part:`(2)start()`
* :need_part:`(awesome_id)blub()`
* :need_part:`(multiline_id)
has multi-lines`


* :np:`unknown_id_1`
Expand Down Expand Up @@ -66,6 +68,17 @@
'links_back': list([
]),
}),
'multiline_id': dict({
'content': '''

has multi-lines
''',
'id': 'multiline_id',
'links': list([
]),
'links_back': list([
]),
}),
}),
'section_name': 'NEED PARTS',
'sections': list([
Expand Down
2 changes: 2 additions & 0 deletions tests/doc_test/doc_need_parts/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ NEED PARTS
* :need_part:`(1)exit()`
* :need_part:`(2)start()`
* :need_part:`(awesome_id)blub()`
* :need_part:`(multiline_id)
has multi-lines`


* :np:`unknown_id_1`
Expand Down

0 comments on commit b3d65c8

Please sign in to comment.