diff options
Diffstat (limited to 'plugins/all-modules-page')
5 files changed, 14 insertions, 21 deletions
diff --git a/plugins/all-modules-page/api/all-modules-page.api b/plugins/all-modules-page/api/all-modules-page.api index 1849c6d9..9d8bca9b 100644 --- a/plugins/all-modules-page/api/all-modules-page.api +++ b/plugins/all-modules-page/api/all-modules-page.api @@ -4,10 +4,10 @@ public final class org/jetbrains/dokka/allModulesPage/AllModulesPageGeneration : public final fun finishProcessingSubmodules ()V public fun generate (Lorg/jetbrains/dokka/Timer;)V public fun getGenerationName ()Ljava/lang/String; - public final fun handlePreviousDocs ()V public final fun processMultiModule (Lorg/jetbrains/dokka/pages/RootPageNode;)V public final fun processSubmodules ()Lorg/jetbrains/dokka/allModulesPage/AllModulesPageGeneration$DefaultAllModulesContext; public final fun render (Lorg/jetbrains/dokka/pages/RootPageNode;)V + public final fun runPostActions ()V public final fun transformAllModulesPage (Lorg/jetbrains/dokka/pages/RootPageNode;)Lorg/jetbrains/dokka/pages/RootPageNode; } @@ -51,8 +51,10 @@ public abstract interface class org/jetbrains/dokka/allModulesPage/ExternalModul } public class org/jetbrains/dokka/allModulesPage/MultimoduleLocationProvider : org/jetbrains/dokka/base/resolvers/local/DokkaBaseLocationProvider { - public fun <init> (Lorg/jetbrains/dokka/pages/RootPageNode;Lorg/jetbrains/dokka/plugability/DokkaContext;)V + public fun <init> (Lorg/jetbrains/dokka/pages/RootPageNode;Lorg/jetbrains/dokka/plugability/DokkaContext;Ljava/lang/String;)V + public synthetic fun <init> (Lorg/jetbrains/dokka/pages/RootPageNode;Lorg/jetbrains/dokka/plugability/DokkaContext;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun ancestors (Lorg/jetbrains/dokka/pages/PageNode;)Ljava/util/List; + public final fun getExtension ()Ljava/lang/String; public fun pathToRoot (Lorg/jetbrains/dokka/pages/PageNode;)Ljava/lang/String; public fun resolve (Lorg/jetbrains/dokka/links/DRI;Ljava/util/Set;Lorg/jetbrains/dokka/pages/PageNode;)Ljava/lang/String; public fun resolve (Lorg/jetbrains/dokka/pages/PageNode;Lorg/jetbrains/dokka/pages/PageNode;Z)Ljava/lang/String; diff --git a/plugins/all-modules-page/build.gradle.kts b/plugins/all-modules-page/build.gradle.kts index 9ab299f6..ff9fcbd8 100644 --- a/plugins/all-modules-page/build.gradle.kts +++ b/plugins/all-modules-page/build.gradle.kts @@ -7,7 +7,6 @@ registerDokkaArtifactPublication("dokkaAllModulesPage") { dependencies { implementation(project(":plugins:base")) implementation(project(":plugins:templating")) - implementation(project(":plugins:versioning")) testImplementation(project(":plugins:base")) testImplementation(project(":plugins:base:base-test-utils")) testImplementation(project(":plugins:gfm")) 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 -> |