aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-09-01 14:20:03 +0200
committerBłażej Kardyś <bkardys@virtuslab.com>2020-09-30 13:43:08 +0200
commit33c1eb4f6ad1d7ec4cd1e7760c37728a930a52b6 (patch)
tree651cc172784f0dcf2c19b0f9e1a995866b48ba1a /plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt
parent377a3dc5578a0d3242cd03ac15196aafa205601a (diff)
downloaddokka-33c1eb4f6ad1d7ec4cd1e7760c37728a930a52b6.tar.gz
dokka-33c1eb4f6ad1d7ec4cd1e7760c37728a930a52b6.tar.bz2
dokka-33c1eb4f6ad1d7ec4cd1e7760c37728a930a52b6.zip
Fix a bug in the DefaultLocationProvider which skipped lookup of some relocated DRIs
Diffstat (limited to 'plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt')
-rw-r--r--plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt16
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt
index b92b5330..2600884d 100644
--- a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt
@@ -10,15 +10,23 @@ open class DefaultExternalLocationProvider(
val extension: String,
val dokkaContext: DokkaContext
) : ExternalLocationProvider {
+ val docURL = externalDocumentation.documentationURL.toString().removeSuffix("/") + "/"
+
override fun resolve(dri: DRI): String? {
- val docURL = externalDocumentation.documentationURL.toString().removeSuffix("/") + "/"
externalDocumentation.packageList.locations[dri.toString()]?.let { path -> return "$docURL$path" }
- val classNamesChecked = dri.classNames ?: return "$docURL${dri.packageName ?: ""}/index$extension"
- val classLink = (listOfNotNull(dri.packageName) + classNamesChecked.split('.'))
+ if (dri.packageName !in externalDocumentation.packageList.packages)
+ return null
+
+ return dri.constructPath()
+ }
+
+ protected open fun DRI.constructPath(): String {
+ val classNamesChecked = classNames ?: return "$docURL${packageName ?: ""}/index$extension"
+ val classLink = (listOfNotNull(packageName) + classNamesChecked.split('.'))
.joinToString("/", transform = ::identifierToFilename)
- val callableChecked = dri.callable ?: return "$docURL$classLink/index$extension"
+ val callableChecked = callable ?: return "$docURL$classLink/index$extension"
return "$docURL$classLink/" + identifierToFilename(callableChecked.name) + extension
}
}