aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKamil Doległo <9080183+kamildoleglo@users.noreply.github.com>2020-10-15 17:04:11 +0200
committerGitHub <noreply@github.com>2020-10-15 17:04:11 +0200
commit9b16f25eb2c29c362f69e5e33fce164ce0dc00e1 (patch)
treeef1f8437e06aace4cd43057177cb1f1c184774ca /plugins
parentbf5e18fd1694882a318e204be6a31bc1757db72d (diff)
downloaddokka-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')
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/JavadocParser.kt15
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()