diff options
author | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2020-10-15 17:04:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-15 17:04:11 +0200 |
commit | 9b16f25eb2c29c362f69e5e33fce164ce0dc00e1 (patch) | |
tree | ef1f8437e06aace4cd43057177cb1f1c184774ca /plugins/base/src/main/kotlin/translators/psi | |
parent | bf5e18fd1694882a318e204be6a31bc1757db72d (diff) | |
download | dokka-9b16f25eb2c29c362f69e5e33fce164ce0dc00e1.tar.gz dokka-9b16f25eb2c29c362f69e5e33fce164ce0dc00e1.tar.bz2 dokka-9b16f25eb2c29c362f69e5e33fce164ce0dc00e1.zip |
Fix unresolved link parsing in Javadoc that resulted in an empty link label (#1566)
Diffstat (limited to 'plugins/base/src/main/kotlin/translators/psi')
-rw-r--r-- | plugins/base/src/main/kotlin/translators/psi/JavadocParser.kt | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/JavadocParser.kt b/plugins/base/src/main/kotlin/translators/psi/JavadocParser.kt index 9ef5ea38..261f98dd 100644 --- a/plugins/base/src/main/kotlin/translators/psi/JavadocParser.kt +++ b/plugins/base/src/main/kotlin/translators/psi/JavadocParser.kt @@ -163,14 +163,17 @@ class JavadocParser( private fun PsiElement.toDocumentationLinkString( labelElement: List<PsiElement>? = null - ): String = - (reference?.resolve()?.takeIf { it !is PsiParameter }?.let { + ): String { + val label = labelElement?.toList().takeUnless { it.isNullOrEmpty() } ?: listOf(defaultLabel()) + + val dri = reference?.resolve()?.takeIf { it !is PsiParameter }?.let { val dri = DRI.from(it) driMap[dri.toString()] = dri - Pair(labelElement ?: listOf(defaultLabel()), dri.toString()) - } ?: Pair(listOf(defaultLabel()), UNRESOLVED_PSI_ELEMENT)).let { (label, dri) -> - """<a data-dri=$dri>${label.joinToString(" ") { it.text }}</a>""" - } + dri.toString() + } ?: UNRESOLVED_PSI_ELEMENT + + return """<a data-dri=$dri>${label.joinToString(" ") { it.text }}</a>""" + } private fun convertInlineDocTag(tag: PsiInlineDocTag) = when (tag.name) { "link", "linkplain" -> tag.referenceElement() |