/* * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package org.jetbrains.dokka.versioning import org.jetbrains.dokka.CoreExtensions.postActions import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.templating.ImmediateHtmlCommandConsumer import org.jetbrains.dokka.plugability.* import org.jetbrains.dokka.renderers.PostAction import org.jetbrains.dokka.templates.CommandHandler import org.jetbrains.dokka.templates.TemplatingPlugin import org.jetbrains.dokka.transformers.pages.PageTransformer public class VersioningPlugin : DokkaPlugin() { public val versioningStorage: ExtensionPoint by extensionPoint() public val versionsNavigationCreator: ExtensionPoint by extensionPoint() public val versionsOrdering: ExtensionPoint by extensionPoint() private val dokkaBase by lazy { plugin() } private val templatingPlugin by lazy { plugin() } public val defaultVersioningStorage: Extension by extending { versioningStorage providing ::DefaultVersioningStorage } public val defaultVersioningNavigationCreator: Extension by extending { versionsNavigationCreator providing ::HtmlVersionsNavigationCreator } public val replaceVersionCommandHandler: Extension by extending { templatingPlugin.directiveBasedCommandHandlers providing ::ReplaceVersionCommandHandler override templatingPlugin.replaceVersionCommandHandler } public val resolveLinkConsumer: Extension by extending { dokkaBase.immediateHtmlCommandConsumer providing ::ReplaceVersionCommandConsumer override dokkaBase.replaceVersionConsumer } public val cssStyleInstaller: Extension by extending { dokkaBase.htmlPreprocessors providing ::MultiModuleStylesInstaller order { after(dokkaBase.assetsInstaller) before(dokkaBase.customResourceInstaller) } } public val notFoundPageInstaller: Extension by extending { dokkaBase.htmlPreprocessors providing ::NotFoundPageInstaller order { after(dokkaBase.assetsInstaller) before(dokkaBase.customResourceInstaller) } applyIf { !delayTemplateSubstitution } } public val versionsDefaultOrdering: Extension by extending { versionsOrdering providing { ctx -> configuration(ctx)?.versionsOrdering?.let { ByConfigurationVersionOrdering(ctx) } ?: SemVerVersionOrdering() } } public val previousDocumentationCopyPostAction: Extension by extending { postActions providing ::DefaultPreviousDocumentationCopyPostAction applyIf { !delayTemplateSubstitution } } @OptIn(DokkaPluginApiPreview::class) override fun pluginApiPreviewAcknowledgement(): PluginApiPreviewAcknowledgement = PluginApiPreviewAcknowledgement }