aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-05-05 01:58:55 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-07-14 23:57:12 +0300
commite38d83905ff706b2d656f12896a6905f5a0729d7 (patch)
tree0f55681838d059da7ed3f1cc0991b61026664a0d
parent6361dd32aaf567c8e03e4aa63006193dc67cca7b (diff)
downloaddokka-e38d83905ff706b2d656f12896a6905f5a0729d7.tar.gz
dokka-e38d83905ff706b2d656f12896a6905f5a0729d7.tar.bz2
dokka-e38d83905ff706b2d656f12896a6905f5a0729d7.zip
Fix inbound links to enum entries
-rw-r--r--core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlPackageListService.kt8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlPackageListService.kt b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlPackageListService.kt
index 6d9b5fd0..09bb2602 100644
--- a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlPackageListService.kt
+++ b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlPackageListService.kt
@@ -3,6 +3,7 @@ package org.jetbrains.dokka.Formats
import org.jetbrains.dokka.*
import org.jetbrains.dokka.ExternalDocumentationLinkResolver.Companion.DOKKA_PARAM_PREFIX
import org.jetbrains.kotlin.descriptors.*
+import org.jetbrains.kotlin.descriptors.impl.EnumEntrySyntheticClassDescriptor
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.descriptorUtil.isCompanionObject
import org.jetbrains.kotlin.types.KotlinType
@@ -33,7 +34,7 @@ class JavaLayoutHtmlPackageListService: PackageListService {
class JavaLayoutHtmlInboundLinkResolutionService(private val paramMap: Map<String, List<String>>) : InboundExternalLinkResolutionService {
private fun getContainerPath(symbol: DeclarationDescriptor): String? {
return when (symbol) {
- is PackageFragmentDescriptor -> symbol.fqName.asString() + "/"
+ is PackageFragmentDescriptor -> symbol.fqName.asString().replace('.', '/') + "/"
is ClassifierDescriptor -> getContainerPath(symbol.findPackage()) + symbol.nameWithOuter() + ".html"
else -> null
}
@@ -49,6 +50,7 @@ class JavaLayoutHtmlInboundLinkResolutionService(private val paramMap: Map<Strin
private fun getPagePath(symbol: DeclarationDescriptor): String? {
return when (symbol) {
is PackageFragmentDescriptor -> getContainerPath(symbol) + "package-summary.html"
+ is EnumEntrySyntheticClassDescriptor -> getContainerPath(symbol.containingDeclaration) + "#" + symbol.signatureForAnchorUrlEncoded()
is ClassifierDescriptor -> getContainerPath(symbol) + "#"
is FunctionDescriptor, is PropertyDescriptor -> getContainerPath(symbol.containingDeclaration!!) + "#" + symbol.signatureForAnchorUrlEncoded()
else -> null
@@ -88,6 +90,10 @@ class JavaLayoutHtmlInboundLinkResolutionService(private val paramMap: Map<Strin
}
return when(this) {
+ is EnumEntrySyntheticClassDescriptor -> buildString {
+ append("ENUM_VALUE:")
+ append(name.asString())
+ }
is FunctionDescriptor -> buildString {
appendReceiverAndCompanion(this@signatureForAnchor)
append(name.asString())