diff --git a/plugins/all-modules-page/src/main/kotlin/ExternalModuleLinkResolver.kt b/plugins/all-modules-page/src/main/kotlin/ExternalModuleLinkResolver.kt index 0fde629c75..60ece00fd8 100644 --- a/plugins/all-modules-page/src/main/kotlin/ExternalModuleLinkResolver.kt +++ b/plugins/all-modules-page/src/main/kotlin/ExternalModuleLinkResolver.kt @@ -67,14 +67,7 @@ class DefaultExternalModuleLinkResolver(val context: DokkaContext) : ExternalMod context.configuration.modules.firstOrNull { it.name == moduleName } ?.let { module -> val packageList = loadPackageListForModule(module) - val extension = when (packageList?.linkFormat) { - RecognizedLinkFormat.KotlinWebsiteHtml, - RecognizedLinkFormat.DokkaOldHtml, - RecognizedLinkFormat.DokkaHtml -> ".html" - RecognizedLinkFormat.DokkaGFM, - RecognizedLinkFormat.DokkaJekyll -> ".md" - else -> "" - } + val extension = packageList?.linkFormat?.linkExtension?.let { ".$it" }.orEmpty() "${module.relativePathToOutputDirectory}/index$extension" } diff --git a/plugins/base/src/main/kotlin/resolvers/shared/RecognizedLinkFormat.kt b/plugins/base/src/main/kotlin/resolvers/shared/RecognizedLinkFormat.kt index 8eeb5dfd95..fedd163c1d 100644 --- a/plugins/base/src/main/kotlin/resolvers/shared/RecognizedLinkFormat.kt +++ b/plugins/base/src/main/kotlin/resolvers/shared/RecognizedLinkFormat.kt @@ -4,7 +4,7 @@ enum class RecognizedLinkFormat(override val formatName: String, override val li DokkaHtml("html-v1", "html"), DokkaJavadoc("javadoc-v1", "html"), DokkaGFM("gfm-v1", "md"), - DokkaJekyll("jekyll-v1", "md"), + DokkaJekyll("jekyll-v1", "html"), Javadoc1("javadoc1", "html"), Javadoc8("javadoc8", "html"), Javadoc10("javadoc10", "html"), diff --git a/plugins/jekyll/jekyll-template-processing/build.gradle.kts b/plugins/jekyll/jekyll-template-processing/build.gradle.kts new file mode 100644 index 0000000000..2ccb6b89c7 --- /dev/null +++ b/plugins/jekyll/jekyll-template-processing/build.gradle.kts @@ -0,0 +1,17 @@ +import org.jetbrains.registerDokkaArtifactPublication + +dependencies { + implementation(project(":plugins:base")) + implementation(project(":plugins:jekyll")) + implementation(project(":plugins:all-modules-page")) + implementation(project(":plugins:templating")) + implementation(project(":plugins:gfm")) + implementation(project(":plugins:gfm:gfm-template-processing")) + + val coroutines_version: String by project + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") +} + +registerDokkaArtifactPublication("dokkaJekyllTemplateProcessing") { + artifactId = "jekyll-template-processing-plugin" +} \ No newline at end of file diff --git a/plugins/jekyll/jekyll-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/JekyllTemplateProcessingPlugin.kt b/plugins/jekyll/jekyll-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/JekyllTemplateProcessingPlugin.kt new file mode 100644 index 0000000000..7e5ab6c60a --- /dev/null +++ b/plugins/jekyll/jekyll-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/JekyllTemplateProcessingPlugin.kt @@ -0,0 +1,36 @@ +package org.jetbrains.dokka.gfm.templateProcessing + +import org.jetbrains.dokka.allModulesPage.AllModulesPagePlugin +import org.jetbrains.dokka.allModulesPage.MultimoduleLocationProvider +import org.jetbrains.dokka.base.DokkaBase +import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProviderFactory +import org.jetbrains.dokka.gfm.GfmPlugin +import org.jetbrains.dokka.jekyll.JekyllPlugin +import org.jetbrains.dokka.plugability.DokkaPlugin + +class JekyllTemplateProcessingPlugin : DokkaPlugin() { + + private val allModulesPagePlugin by lazy { plugin() } + + private val jekyllPlugin by lazy { plugin() } + private val gfmPlugin by lazy { plugin() } + private val gfmTemplatingPlugin by lazy { plugin() } + + private val dokkaBase by lazy { plugin() } + + val jekyllLocationProvider by extending { + dokkaBase.locationProviderFactory providing MultimoduleLocationProvider::Factory override listOf( + jekyllPlugin.locationProvider, + gfmPlugin.locationProvider, + gfmTemplatingPlugin.gfmLocationProvider, + allModulesPagePlugin.multimoduleLocationProvider + ) + } + + val jekyllPartialLocationProvider by extending { + allModulesPagePlugin.partialLocationProviderFactory providing ::DokkaLocationProviderFactory override listOf( + allModulesPagePlugin.baseLocationProviderFactory, + gfmTemplatingPlugin.gfmPartialLocationProvider + ) + } +} \ No newline at end of file diff --git a/plugins/jekyll/jekyll-template-processing/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin b/plugins/jekyll/jekyll-template-processing/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin new file mode 100644 index 0000000000..492c7af89a --- /dev/null +++ b/plugins/jekyll/jekyll-template-processing/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin @@ -0,0 +1 @@ +org.jetbrains.dokka.gfm.templateProcessing.JekyllTemplateProcessingPlugin \ No newline at end of file diff --git a/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt b/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt index bcc73862bb..13e9353934 100644 --- a/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt +++ b/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt @@ -1,11 +1,14 @@ package org.jetbrains.dokka.jekyll import org.jetbrains.dokka.CoreExtensions +import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.renderers.PackageListCreator import org.jetbrains.dokka.base.renderers.RootCreator +import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProviderFactory import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer import org.jetbrains.dokka.gfm.GfmPlugin +import org.jetbrains.dokka.gfm.location.MarkdownLocationProvider import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin @@ -19,6 +22,10 @@ class JekyllPlugin : DokkaPlugin() { val jekyllPreprocessors by extensionPoint() + private val dokkaBase by lazy { plugin() } + + private val gfmPlugin by lazy { plugin() } + val renderer by extending { (CoreExtensions.renderer providing { JekyllRenderer(it) } @@ -34,6 +41,10 @@ class JekyllPlugin : DokkaPlugin() { PackageListCreator(it, RecognizedLinkFormat.DokkaJekyll) } order { after(rootCreator) } } + + val locationProvider by extending { + dokkaBase.locationProviderFactory providing { ctx -> DokkaLocationProviderFactory(ctx) } override listOf(gfmPlugin.locationProvider) + } } class JekyllRenderer( diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaArtifacts.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaArtifacts.kt index f5d7e9c8b5..6574eeb5fa 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaArtifacts.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaArtifacts.kt @@ -15,5 +15,6 @@ internal class DokkaArtifacts(private val project: Project) { val javadocPlugin get() = fromModuleName("javadoc-plugin") val gfmPlugin get() = fromModuleName("gfm-plugin") val gfmTemplateProcessing get() = fromModuleName("gfm-template-processing-plugin") + val jekyllTemplateProcessing get() = fromModuleName("jekyll-template-processing-plugin") val jekyllPlugin get() = fromModuleName("jekyll-plugin") } diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt index 004e1a6fa9..483090da3c 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt @@ -26,7 +26,7 @@ open class DokkaPlugin : Plugin { description = "Generates documentation in GitHub flavored markdown format" } - project.setupDokkaTasks("dokkaJekyll", allModulesPageAndTemplateProcessing = project.dokkaArtifacts.gfmTemplateProcessing) { + project.setupDokkaTasks("dokkaJekyll", allModulesPageAndTemplateProcessing = project.dokkaArtifacts.jekyllTemplateProcessing) { plugins.dependencies.add(project.dokkaArtifacts.jekyllPlugin) description = "Generates documentation in Jekyll flavored markdown format" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 9ef4ac9a91..8e4628b352 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -25,6 +25,7 @@ include("plugins:mathjax") include("plugins:gfm") include("plugins:gfm:gfm-template-processing") include("plugins:jekyll") +include("plugins:jekyll:jekyll-template-processing") include("plugins:kotlin-as-java") include("plugins:javadoc")