Skip to content

Commit d9daaca

Browse files
authored
Merge pull request #703 from kuanchihwang/staging/fix-summary-key-handling
Fix incorrect handling for the `summary` key in documentation metadata
2 parents ec5a516 + 6ba8c7d commit d9daaca

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

ford/sourceform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def markdown(self, md: MetaMarkdown):
432432
)
433433

434434
if self.meta.summary is not None:
435-
self.meta.summary = md.convert("\n".join(self.meta.summary), context=self)
435+
self.meta.summary = md.convert(" ".join(self.meta.summary.split()), context=self)
436436
elif paragraph := PARA_CAPTURE_RE.search(self.doc):
437437
# If there is no stand-alone webpage for this item, e.g.
438438
# an internal routine, make the whole doc blob appear,

test/test_sourceform.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,3 +2268,24 @@ def test_no_space_after_character_type(parse_fortran_file):
22682268
source = parse_fortran_file(data)
22692269
function = source.functions[0]
22702270
assert function.name.lower() == "firstword"
2271+
2272+
2273+
def test_summary_handling_bug703(parse_fortran_file):
2274+
"""Check that `summary` works, PR #703"""
2275+
data = """\
2276+
!> summary: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
2277+
!> Fusce ultrices tortor et felis tempus vehicula.
2278+
!> Nulla gravida, magna ut pharetra.
2279+
!>
2280+
!> Full description
2281+
module test
2282+
end module myModule
2283+
"""
2284+
2285+
fortran_file = parse_fortran_file(data)
2286+
md = MetaMarkdown()
2287+
2288+
module = fortran_file.modules[0]
2289+
module.markdown(md)
2290+
2291+
assert "Lorem ipsum" in module.meta.summary

0 commit comments

Comments
 (0)