diff options
author | Błażej Kardyś <bkardys@virtuslab.com> | 2020-05-27 01:16:48 +0200 |
---|---|---|
committer | Błażej Kardyś <bkardys@virtuslab.com> | 2020-06-04 11:26:05 +0200 |
commit | 6dc9498ca849645ecb4ec923bb7116b245dca706 (patch) | |
tree | 23022e6d6f3aea18b9e8efaaa482cafae9bee989 /plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt | |
parent | b614604effda51ca7c76c8901be78ced62b642b2 (diff) | |
download | dokka-6dc9498ca849645ecb4ec923bb7116b245dca706.tar.gz dokka-6dc9498ca849645ecb4ec923bb7116b245dca706.tar.bz2 dokka-6dc9498ca849645ecb4ec923bb7116b245dca706.zip |
All modules page generation
Diffstat (limited to 'plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt')
-rw-r--r-- | plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt new file mode 100644 index 00000000..21692bf9 --- /dev/null +++ b/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt @@ -0,0 +1,32 @@ +package org.jetbrains.dokka.base.resolvers.local + +import org.jetbrains.dokka.links.DRI +import org.jetbrains.dokka.model.SourceSetData +import org.jetbrains.dokka.pages.PageNode +import org.jetbrains.dokka.pages.RootPageNode +import org.jetbrains.dokka.plugability.DokkaContext + +class MultimoduleLocationProvider(private val root: RootPageNode, context: DokkaContext) : LocationProvider { + + val defaultLocationProvider = DefaultLocationProvider(root, context) + + val paths = context.configuration.modules.map { + it.name to it.path + }.toMap() + + override fun resolve(dri: DRI, platforms: List<SourceSetData>, context: PageNode?): String = + dri.takeIf { it.packageName == MULTIMODULE_PACKAGE_PLACEHOLDER }?.classNames?.let { paths[it] }?.let { + "$it/${dri.classNames}/index.html" + } ?: defaultLocationProvider.resolve(dri, platforms, context) + + override fun resolve(node: PageNode, context: PageNode?, skipExtension: Boolean): String = + defaultLocationProvider.resolve(node, context, skipExtension) + + override fun resolveRoot(node: PageNode): String = defaultLocationProvider.resolveRoot(node) + + override fun ancestors(node: PageNode): List<PageNode> = listOf(root) + + companion object { + const val MULTIMODULE_PACKAGE_PLACEHOLDER = ".ext" + } +}
\ No newline at end of file |