aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/parsers
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2020-12-15 17:32:50 +0100
committerGitHub <noreply@github.com>2020-12-15 17:32:50 +0100
commit4f231b3666568e1f2a5a3241e87c2cbc26af6127 (patch)
tree4bd9ec881dcea84b15fa87d04048881bf6411947 /plugins/base/src/main/kotlin/parsers
parenta11745b96c66512e0d05318cfabc8ac4471fd1cf (diff)
downloaddokka-4f231b3666568e1f2a5a3241e87c2cbc26af6127.tar.gz
dokka-4f231b3666568e1f2a5a3241e87c2cbc26af6127.tar.bz2
dokka-4f231b3666568e1f2a5a3241e87c2cbc26af6127.zip
Fix wrong docs on DProperty (#1671)
Diffstat (limited to 'plugins/base/src/main/kotlin/parsers')
-rw-r--r--plugins/base/src/main/kotlin/parsers/MarkdownParser.kt7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt b/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt
index 0b9a5c23..a27734cc 100644
--- a/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt
+++ b/plugins/base/src/main/kotlin/parsers/MarkdownParser.kt
@@ -452,8 +452,9 @@ open class MarkdownParser(
if (link is DocumentationLink) link.dri else null
}
+ val allTags = listOf(kDocTag) + if(kDocTag.canHaveParent()) getAllKDocTags(findParent(kDocTag)) else emptyList()
DocumentationNode(
- (listOf(kDocTag) + getAllKDocTags(findParent(kDocTag))).map {
+ allTags.map {
when (it.knownTag) {
null -> if (it.name == null) Description(parseStringToDocNode(it.getContent())) else CustomTagWrapper(
parseStringToDocNode(it.getContent()),
@@ -511,7 +512,9 @@ open class MarkdownParser(
fun DRI.fqName(): String? = "$packageName.$classNames".takeIf { packageName != null && classNames != null }
private fun findParent(kDoc: PsiElement): PsiElement =
- if (kDoc is KDocSection) findParent(kDoc.parent) else kDoc
+ if (kDoc.canHaveParent()) findParent(kDoc.parent) else kDoc
+
+ private fun PsiElement.canHaveParent(): Boolean = this is KDocSection && knownTag != KDocKnownTag.PROPERTY
private fun getAllKDocTags(kDocImpl: PsiElement): List<KDocTag> =
kDocImpl.children.filterIsInstance<KDocTag>().filterNot { it is KDocSection } + kDocImpl.children.flatMap {