aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/transformers
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2020-07-17 03:48:03 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-11 14:27:44 +0200
commitaeb2014eee704be377c06205d16f60562d2a8cf1 (patch)
treed144b627a0b379bebedf7e015f6d469fea61d0bb /plugins/base/src/main/kotlin/transformers
parent49c9bcc586abb7c78f569526a05fea97da86993d (diff)
downloaddokka-aeb2014eee704be377c06205d16f60562d2a8cf1.tar.gz
dokka-aeb2014eee704be377c06205d16f60562d2a8cf1.tar.bz2
dokka-aeb2014eee704be377c06205d16f60562d2a8cf1.zip
Fixing javadoc comment parser for psi files
Diffstat (limited to 'plugins/base/src/main/kotlin/transformers')
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
index 0f953e0f..9d667623 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
@@ -53,6 +53,9 @@ object DocTagToContentConverter : CommentsToContentConverter {
)
)
+ fun P.collapseParagraphs(): P =
+ if (children.size == 1 && children.first() is P) (children.first() as P).collapseParagraphs() else this
+
return when (docTag) {
is H1 -> buildHeader(1)
is H2 -> buildHeader(2)
@@ -63,12 +66,14 @@ object DocTagToContentConverter : CommentsToContentConverter {
is Ul -> buildList(false)
is Ol -> buildList(true, docTag.params["start"]?.toInt() ?: 1)
is Li -> listOf(
- ContentGroup(children = buildChildren(docTag), dci, sourceSets, styles, extra)
+ ContentGroup(buildChildren(docTag), dci, sourceSets, styles, extra)
)
is Br -> buildNewLine()
is B -> buildChildren(docTag, setOf(TextStyle.Strong))
is I -> buildChildren(docTag, setOf(TextStyle.Italic))
- is P -> buildChildren(docTag, newStyles = setOf(TextStyle.Paragraph))
+ is P -> listOf(
+ ContentGroup(buildChildren(docTag.collapseParagraphs()), dci, sourceSets, styles + setOf(TextStyle.Paragraph), extra)
+ )
is A -> listOf(
ContentResolvedLink(
buildChildren(docTag),