File tree 1 file changed +12
-10
lines changed
compiler/src/dotty/tools/dotc/util
1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -53,24 +53,26 @@ class ParsedComment(val comment: Comment) {
53
53
*
54
54
* The different sections are formatted according to the mapping in `knownTags`.
55
55
*/
56
- def renderAsMarkdown (using Context ): String = {
56
+ def renderAsMarkdown (using Context ): String =
57
57
val buf = new StringBuilder
58
- buf.append(mainDoc + System .lineSeparator + System .lineSeparator )
58
+ buf.append(mainDoc)
59
59
val groupedSections = CommentParsing .groupedSections(content, tagIndex)
60
60
61
- for {
61
+ val sections = for {
62
62
(tag, formatter) <- ParsedComment .knownTags
63
63
boundss <- groupedSections.get(tag)
64
64
texts = boundss.map { case (start, end) => clean(content.slice(start, end)) }
65
65
formatted <- formatter(texts)
66
- }
67
- {
68
- buf.append(formatted)
69
- buf.append(System .lineSeparator)
70
- }
71
-
66
+ } yield formatted
67
+
68
+ if sections.nonEmpty then
69
+ buf.append(System .lineSeparator + System .lineSeparator)
70
+ sections.foreach { section =>
71
+ buf.append(section)
72
+ buf.append(System .lineSeparator)
73
+ }
72
74
buf.toString
73
- }
75
+ end renderAsMarkdown
74
76
75
77
/**
76
78
* The `@param` section corresponding to `name`.
You can’t perform that action at this time.
0 commit comments