diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-09-01 14:20:03 +0200 |
---|---|---|
committer | Błażej Kardyś <bkardys@virtuslab.com> | 2020-09-30 13:43:08 +0200 |
commit | 33c1eb4f6ad1d7ec4cd1e7760c37728a930a52b6 (patch) | |
tree | 651cc172784f0dcf2c19b0f9e1a995866b48ba1a /plugins/base/src/main/kotlin/resolvers/external/Dokka010ExternalLocationProvider.kt | |
parent | 377a3dc5578a0d3242cd03ac15196aafa205601a (diff) | |
download | dokka-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/Dokka010ExternalLocationProvider.kt')
-rw-r--r-- | plugins/base/src/main/kotlin/resolvers/external/Dokka010ExternalLocationProvider.kt | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/external/Dokka010ExternalLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/external/Dokka010ExternalLocationProvider.kt index 45440d2b..06253ae7 100644 --- a/plugins/base/src/main/kotlin/resolvers/external/Dokka010ExternalLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/external/Dokka010ExternalLocationProvider.kt @@ -11,15 +11,21 @@ open class Dokka010ExternalLocationProvider( 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("/") + "/" - val fqName = listOfNotNull(dri.packageName.takeIf { it?.isNotBlank() == true }, - dri.classNames.takeIf { it?.isNotBlank() == true }?.removeCompanion()).joinToString(".") + val fqName = listOfNotNull( + dri.packageName.takeIf { it?.isNotBlank() == true }, + dri.classNames.takeIf { it?.isNotBlank() == true }?.removeCompanion() + ).joinToString(".") val relocationId = fqName.let { if (dri.callable != null) it + "$" + dri.callable!!.toOldString() else it } externalDocumentation.packageList.locations[relocationId]?.let { path -> return "$docURL$path" } + if (dri.packageName !in externalDocumentation.packageList.packages) + return null + val classNamesChecked = dri.classNames?.removeCompanion() ?: return "$docURL${dri.packageName ?: ""}/index$extension" @@ -29,6 +35,7 @@ open class Dokka010ExternalLocationProvider( val callableChecked = dri.callable ?: return "$docURL$classLink/index$extension" return "$docURL$classLink/" + identifierToFilename(callableChecked.name) + extension } + private fun String.removeCompanion() = removeSuffix(".Companion") private fun Callable.toOldString() = name + params.joinToString(", ", "(", ")") + (receiver?.let { "#$it" } ?: "") |