blob: d42b5b5c4b82b3dadb339f7794d953523a5ca7b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package org.jetbrains.dokka.base.resolvers.external.javadoc
import org.jetbrains.dokka.base.resolvers.external.DefaultExternalLocationProvider
import org.jetbrains.dokka.base.resolvers.shared.ExternalDocumentationInfo
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.utilities.htmlEscape
class JavadocExternalLocationProvider(
externalDocumentationInfo: ExternalDocumentationInfo,
val brackets: String,
val separator: String,
dokkaContext: DokkaContext
) : DefaultExternalLocationProvider(externalDocumentationInfo, ".html", dokkaContext) {
override fun resolve(dri: DRI): String? {
val docURL = externalDocumentationInfo.documentationURL.toString().removeSuffix("/") + "/"
val packageLink = dri.packageName?.replace(".", "/")
if (dri.classNames == null) {
return "$docURL$packageLink/package-summary$extension".htmlEscape()
}
val classLink = if (packageLink == null) "${dri.classNames}$extension" else "$packageLink/${dri.classNames}$extension"
val callableChecked = dri.callable ?: return "$docURL$classLink".htmlEscape()
return ("$docURL$classLink#" +
callableChecked.name +
"${brackets.first()}" +
callableChecked.params.joinToString(separator) +
"${brackets.last()}").htmlEscape()
}
}
|