diff options
Diffstat (limited to 'plugins/all-modules-page/src/main')
3 files changed, 10 insertions, 18 deletions
diff --git a/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt b/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt index 21c624ef..8558750e 100644 --- a/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt +++ b/plugins/all-modules-page/src/main/kotlin/AllModulesPageGeneration.kt @@ -11,13 +11,11 @@ import org.jetbrains.dokka.plugability.querySingle import org.jetbrains.dokka.templates.TemplatingPlugin import org.jetbrains.dokka.templates.TemplatingResult import org.jetbrains.dokka.transformers.pages.CreationContext -import org.jetbrains.dokka.versioning.VersioningPlugin class AllModulesPageGeneration(private val context: DokkaContext) : Generation { private val allModulesPagePlugin by lazy { context.plugin<AllModulesPagePlugin>() } private val templatingPlugin by lazy { context.plugin<TemplatingPlugin>() } - private val versioningPlugin by lazy { context.plugin<VersioningPlugin>() } override fun Timer.generate() { report("Processing submodules") @@ -26,9 +24,6 @@ class AllModulesPageGeneration(private val context: DokkaContext) : Generation { report("Creating all modules page") val pages = createAllModulesPage(generationContext) - report("Copy previous documentation") - handlePreviousDocs() - report("Transforming pages") val transformedPages = transformAllModulesPage(pages) @@ -40,12 +35,13 @@ class AllModulesPageGeneration(private val context: DokkaContext) : Generation { report("Finish submodule processing") finishProcessingSubmodules() + + report("Running post-actions") + runPostActions() } override val generationName = "index page for project" - fun handlePreviousDocs() = versioningPlugin.querySingle { versioningHandler }.invoke() - fun createAllModulesPage(allModulesContext: DefaultAllModulesContext) = allModulesPagePlugin.querySingle { allModulesPageCreator }.invoke(allModulesContext) @@ -56,6 +52,10 @@ class AllModulesPageGeneration(private val context: DokkaContext) : Generation { context.single(CoreExtensions.renderer).render(transformedPages) } + fun runPostActions() { + context[CoreExtensions.postActions].forEach { it() } + } + fun processSubmodules() = templatingPlugin.querySingle { submoduleTemplateProcessor } .process(context.configuration.modules) diff --git a/plugins/all-modules-page/src/main/kotlin/MultimoduleLocationProvider.kt b/plugins/all-modules-page/src/main/kotlin/MultimoduleLocationProvider.kt index 1a323f63..dab5be09 100644 --- a/plugins/all-modules-page/src/main/kotlin/MultimoduleLocationProvider.kt +++ b/plugins/all-modules-page/src/main/kotlin/MultimoduleLocationProvider.kt @@ -12,7 +12,8 @@ import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.plugability.querySingle -open class MultimoduleLocationProvider(private val root: RootPageNode, dokkaContext: DokkaContext) : +open class MultimoduleLocationProvider(private val root: RootPageNode, dokkaContext: DokkaContext, + val extension: String = ".html") : DokkaBaseLocationProvider(root, dokkaContext) { private val defaultLocationProvider = @@ -27,7 +28,7 @@ open class MultimoduleLocationProvider(private val root: RootPageNode, dokkaCont ?.let(externalModuleLinkResolver::resolveLinkToModuleIndex) override fun resolve(node: PageNode, context: PageNode?, skipExtension: Boolean) = - if (node is ContentPage && MultimodulePageCreator.MULTIMODULE_ROOT_DRI in node.dri) pathToRoot(root) + "index" + if (node is ContentPage && MultimodulePageCreator.MULTIMODULE_ROOT_DRI in node.dri) pathToRoot(root) + "index" + if (!skipExtension) extension else "" else defaultLocationProvider.resolve(node, context, skipExtension) override fun pathToRoot(from: PageNode): String = defaultLocationProvider.pathToRoot(from) diff --git a/plugins/all-modules-page/src/main/kotlin/MultimodulePageCreator.kt b/plugins/all-modules-page/src/main/kotlin/MultimodulePageCreator.kt index 4285046a..f522fd4c 100644 --- a/plugins/all-modules-page/src/main/kotlin/MultimodulePageCreator.kt +++ b/plugins/all-modules-page/src/main/kotlin/MultimodulePageCreator.kt @@ -19,14 +19,10 @@ import org.jetbrains.dokka.model.doc.P import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext -import org.jetbrains.dokka.plugability.configuration import org.jetbrains.dokka.plugability.plugin import org.jetbrains.dokka.plugability.querySingle import org.jetbrains.dokka.transformers.pages.PageCreator import org.jetbrains.dokka.utilities.DokkaLogger -import org.jetbrains.dokka.versioning.ReplaceVersionsCommand -import org.jetbrains.dokka.versioning.VersioningConfiguration -import org.jetbrains.dokka.versioning.VersioningPlugin import java.io.File class MultimodulePageCreator( @@ -46,11 +42,6 @@ class MultimodulePageCreator( kind = ContentKind.Cover, sourceSets = sourceSetData ) { - /* The line below checks if there is a provided configuration for versioning. - If not, we are skipping the template for inserting versions navigation */ - configuration<VersioningPlugin, VersioningConfiguration>(context)?.let { - group(extra = PropertyContainer.withAll(InsertTemplateExtra(ReplaceVersionsCommand))) { } - } getMultiModuleDocumentation(context.configuration.includes).takeIf { it.isNotEmpty() }?.let { nodes -> group(kind = ContentKind.Cover) { nodes.forEach { node -> |