aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()