From d41965ca3cb180bc82bd5dd6fa747d2b83381b31 Mon Sep 17 00:00:00 2001 From: Paweł Marks Date: Wed, 7 Oct 2020 19:36:49 +0200 Subject: Implement immediate temaplates resolution --- plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt | 1 - .../src/main/kotlin/templates/DirectiveBasedTemplateProcessing.kt | 4 ++-- .../src/main/kotlin/templates/PathToRootSubstitutor.kt | 6 ++---- 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'plugins/all-module-page/src') diff --git a/plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt b/plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt index 3ad3e0ce..c3806b00 100644 --- a/plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt +++ b/plugins/all-module-page/src/main/kotlin/MultimodulePageCreator.kt @@ -64,7 +64,6 @@ class MultimodulePageCreator( } } return MultimoduleRootPageNode( - "Modules", setOf(DRI(packageName = MULTIMODULE_PACKAGE_PLACEHOLDER, classNames = "allModules")), contentNode ) diff --git a/plugins/all-module-page/src/main/kotlin/templates/DirectiveBasedTemplateProcessing.kt b/plugins/all-module-page/src/main/kotlin/templates/DirectiveBasedTemplateProcessing.kt index d50cbc32..e609397b 100644 --- a/plugins/all-module-page/src/main/kotlin/templates/DirectiveBasedTemplateProcessing.kt +++ b/plugins/all-module-page/src/main/kotlin/templates/DirectiveBasedTemplateProcessing.kt @@ -156,8 +156,8 @@ class DirectiveBasedTemplateProcessingStrategy(private val context: DokkaContext return } - val modulePath = context.configuration.outputDir.absolutePath.split("/") - val contextPath = fileContext.absolutePath.split("/") + val modulePath = context.configuration.outputDir.absolutePath.split(File.separator) + val contextPath = fileContext.absolutePath.split(File.separator) val commonPathElements = modulePath.zip(contextPath) .takeWhile { (a, b) -> a == b }.count() diff --git a/plugins/all-module-page/src/main/kotlin/templates/PathToRootSubstitutor.kt b/plugins/all-module-page/src/main/kotlin/templates/PathToRootSubstitutor.kt index 992ee7ed..5056b724 100644 --- a/plugins/all-module-page/src/main/kotlin/templates/PathToRootSubstitutor.kt +++ b/plugins/all-module-page/src/main/kotlin/templates/PathToRootSubstitutor.kt @@ -1,16 +1,14 @@ package org.jetbrains.dokka.allModulesPage.templates -import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.templating.PathToRootSubstitutionCommand import org.jetbrains.dokka.base.templating.SubstitutionCommand import org.jetbrains.dokka.plugability.DokkaContext -import org.jetbrains.dokka.plugability.query -import java.nio.file.Path +import java.io.File class PathToRootSubstitutor(private val dokkaContext: DokkaContext) : Substitutor { override fun trySubstitute(context: TemplatingContext, match: MatchResult): String? = if (context.command is PathToRootSubstitutionCommand) { - context.output.toPath().parent.relativize(dokkaContext.configuration.outputDir.toPath()).toString() + "/" + context.output.toPath().parent.relativize(dokkaContext.configuration.outputDir.toPath()).toString().split(File.separator).joinToString(separator = "/", postfix = "/") { it } } else null } \ No newline at end of file -- cgit