File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
compiler/src/dotty/tools/dotc/util Expand file tree Collapse file tree 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) {
5353 *
5454 * The different sections are formatted according to the mapping in `knownTags`.
5555 */
56- def renderAsMarkdown (using Context ): String = {
56+ def renderAsMarkdown (using Context ): String =
5757 val buf = new StringBuilder
58- buf.append(mainDoc + System .lineSeparator + System .lineSeparator )
58+ buf.append(mainDoc)
5959 val groupedSections = CommentParsing .groupedSections(content, tagIndex)
6060
61- for {
61+ val sections = for {
6262 (tag, formatter) <- ParsedComment .knownTags
6363 boundss <- groupedSections.get(tag)
6464 texts = boundss.map { case (start, end) => clean(content.slice(start, end)) }
6565 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+ }
7274 buf.toString
73- }
75+ end renderAsMarkdown
7476
7577 /**
7678 * The `@param` section corresponding to `name`.
You can’t perform that action at this time.
0 commit comments