aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/resolvers/external
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin/resolvers/external')
-rw-r--r--plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt14
-rw-r--r--plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt27
2 files changed, 31 insertions, 10 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt
index 09eb7cc4..fc7f57f4 100644
--- a/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/external/DefaultExternalLocationProvider.kt
@@ -22,11 +22,21 @@ open class DefaultExternalLocationProvider(
}
protected open fun DRI.constructPath(): String {
- val classNamesChecked = classNames ?: return "$docURL${packageName ?: ""}/index$extension"
+ val modulePart = packageName?.let { packageName ->
+ externalDocumentation.packageList.moduleFor(packageName)?.let {
+ if (it.isNotBlank())
+ "$it/"
+ else
+ ""
+ }
+ }.orEmpty()
+
+ val docWithModule = docURL + modulePart
+ val classNamesChecked = classNames ?: return "$docWithModule${packageName ?: ""}/index$extension"
val classLink = (listOfNotNull(packageName) + classNamesChecked.split('.'))
.joinToString("/", transform = ::identifierToFilename)
val fileName = callable?.let { identifierToFilename(it.name) } ?: "index"
- return "$docURL$classLink/$fileName$extension"
+ return "$docWithModule$classLink/$fileName$extension"
}
}
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 b0398cd7..f1a32cb4 100644
--- a/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt
+++ b/plugins/base/src/main/kotlin/resolvers/external/javadoc/JavadocExternalLocationProvider.kt
@@ -8,22 +8,33 @@ import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.utilities.htmlEscape
open class JavadocExternalLocationProvider(
- externalDocumentation: ExternalDocumentation,
- val brackets: String,
- val separator: String,
- dokkaContext: DokkaContext
+ externalDocumentation: ExternalDocumentation,
+ val brackets: String,
+ val separator: String,
+ dokkaContext: DokkaContext
) : DefaultExternalLocationProvider(externalDocumentation, ".html", dokkaContext) {
override fun DRI.constructPath(): String {
val packageLink = packageName?.replace(".", "/")
+ val modulePart = packageName?.let { packageName ->
+ externalDocumentation.packageList.moduleFor(packageName)?.let {
+ if (it.isNotBlank())
+ "$it/"
+ else
+ ""
+ }
+ }.orEmpty()
+
+ val docWithModule = docURL + modulePart
+
if (classNames == null) {
- return "$docURL$packageLink/package-summary$extension".htmlEscape()
+ return "$docWithModule$packageLink/package-summary$extension".htmlEscape()
}
val classLink =
- if (packageLink == null) "${classNames}$extension" else "$packageLink/${classNames}$extension"
- val callableChecked = callable ?: return "$docURL$classLink".htmlEscape()
+ if (packageLink == null) "${classNames}$extension" else "$packageLink/${classNames}$extension"
+ val callableChecked = callable ?: return "$docWithModule$classLink".htmlEscape()
- return ("$docURL$classLink#" + anchorPart(callableChecked)).htmlEscape()
+ return ("$docWithModule$classLink#" + anchorPart(callableChecked)).htmlEscape()
}
protected open fun anchorPart(callable: Callable) = callable.name +