diff options
author | vmishenev <vad-mishenev@yandex.ru> | 2021-09-21 21:38:44 +0300 |
---|---|---|
committer | vmishenev <vad-mishenev@yandex.ru> | 2021-09-21 21:40:12 +0300 |
commit | 1ada27414d66e58b19e20a968834356e81dd26b2 (patch) | |
tree | 41a1f463df9f261fc8c0a7569088263310c227de /plugins/base/src/main/kotlin | |
parent | 2c6169ad8c3f97e7b9f833879967497efd54ac2e (diff) | |
download | dokka-1ada27414d66e58b19e20a968834356e81dd26b2.tar.gz dokka-1ada27414d66e58b19e20a968834356e81dd26b2.tar.bz2 dokka-1ada27414d66e58b19e20a968834356e81dd26b2.zip |
Fix link to javadoc enum entry (#2131)
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r-- | plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt index f1a32cb4..84445d2a 100644 --- a/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt @@ -2,8 +2,7 @@ package org.jetbrains.dokka.base.resolvers.external.javadoc import org.jetbrains.dokka.base.resolvers.external.DefaultExternalLocationProvider import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentation -import org.jetbrains.dokka.links.Callable -import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.links.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.utilities.htmlEscape @@ -30,8 +29,21 @@ open class JavadocExternalLocationProvider( if (classNames == null) { return "$docWithModule$packageLink/package-summary$extension".htmlEscape() } - val classLink = - if (packageLink == null) "${classNames}$extension" else "$packageLink/${classNames}$extension" + + // in Kotlin DRI of enum entry is not callable + if (DRIExtraContainer(extra)[EnumEntryDRIExtra] != null) { + val (classSplit, enumEntityAnchor) = if (callable == null) { + val lastIndex = classNames?.lastIndexOf(".") ?: 0 + classNames?.substring(0, lastIndex) to classNames?.substring(lastIndex + 1) + } else + classNames to callable?.name + + val classLink = + if (packageLink == null) "${classSplit}$extension" else "$packageLink/${classSplit}$extension" + return "$docWithModule$classLink#$enumEntityAnchor".htmlEscape() + } + + val classLink = if (packageLink == null) "${classNames}$extension" else "$packageLink/${classNames}$extension" val callableChecked = callable ?: return "$docWithModule$classLink".htmlEscape() return ("$docWithModule$classLink#" + anchorPart(callableChecked)).htmlEscape() |