diff options
Diffstat (limited to 'plugins')
8 files changed, 69 insertions, 9 deletions
diff --git a/plugins/all-modules-page/src/main/kotlin/ExternalModuleLinkResolver.kt b/plugins/all-modules-page/src/main/kotlin/ExternalModuleLinkResolver.kt index e7925ead..fcb129ec 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 8eeb5dfd..fedd163c 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/api/jekyll.api b/plugins/jekyll/api/jekyll.api index 28d01241..2d75b214 100644 --- a/plugins/jekyll/api/jekyll.api +++ b/plugins/jekyll/api/jekyll.api @@ -2,6 +2,7 @@ public final class org/jetbrains/dokka/jekyll/JekyllPlugin : org/jetbrains/dokka public fun <init> ()V public final fun getBriefCommentPreprocessor ()Lorg/jetbrains/dokka/plugability/Extension; public final fun getJekyllPreprocessors ()Lorg/jetbrains/dokka/plugability/ExtensionPoint; + public final fun getLocationProvider ()Lorg/jetbrains/dokka/plugability/Extension; public final fun getPackageListCreator ()Lorg/jetbrains/dokka/plugability/Extension; public final fun getRenderer ()Lorg/jetbrains/dokka/plugability/Extension; public final fun getRootCreator ()Lorg/jetbrains/dokka/plugability/Extension; diff --git a/plugins/jekyll/jekyll-template-processing/api/jekyll-template-processing.api b/plugins/jekyll/jekyll-template-processing/api/jekyll-template-processing.api new file mode 100644 index 00000000..482a0d40 --- /dev/null +++ b/plugins/jekyll/jekyll-template-processing/api/jekyll-template-processing.api @@ -0,0 +1,6 @@ +public final class org/jetbrains/dokka/gfm/templateProcessing/JekyllTemplateProcessingPlugin : org/jetbrains/dokka/plugability/DokkaPlugin { + public fun <init> ()V + public final fun getJekyllLocationProvider ()Lorg/jetbrains/dokka/plugability/Extension; + public final fun getJekyllPartialLocationProvider ()Lorg/jetbrains/dokka/plugability/Extension; +} + 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 00000000..2ccb6b89 --- /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 00000000..fc4f67de --- /dev/null +++ b/plugins/jekyll/jekyll-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/JekyllTemplateProcessingPlugin.kt @@ -0,0 +1,32 @@ +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.jekyll.JekyllPlugin +import org.jetbrains.dokka.plugability.DokkaPlugin + +class JekyllTemplateProcessingPlugin : DokkaPlugin() { + + private val allModulesPagePlugin by lazy { plugin<AllModulesPagePlugin>() } + + private val jekyllPlugin by lazy { plugin<JekyllPlugin>() } + private val gfmTemplatingPlugin by lazy { plugin<GfmTemplateProcessingPlugin>() } + + private val dokkaBase by lazy { plugin<DokkaBase>() } + + val jekyllLocationProvider by extending { + dokkaBase.locationProviderFactory providing MultimoduleLocationProvider::Factory override listOf( + jekyllPlugin.locationProvider, + gfmTemplatingPlugin.gfmLocationProvider + ) + } + + val jekyllPartialLocationProvider by extending { + allModulesPagePlugin.partialLocationProviderFactory providing ::DokkaLocationProviderFactory override listOf( + allModulesPagePlugin.baseLocationProviderFactory, + gfmTemplatingPlugin.gfmPartialLocationProvider + ) + } +} 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 00000000..492c7af8 --- /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 675dfb39..4dfd21d3 100644 --- a/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt +++ b/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt @@ -1,8 +1,10 @@ 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.GfmPlugin import org.jetbrains.dokka.gfm.renderer.BriefCommentPreprocessor @@ -18,6 +20,10 @@ class JekyllPlugin : DokkaPlugin() { val jekyllPreprocessors by extensionPoint<PageTransformer>() + private val dokkaBase by lazy { plugin<DokkaBase>() } + + private val gfmPlugin by lazy { plugin<GfmPlugin>() } + val renderer by extending { (CoreExtensions.renderer providing { JekyllRenderer(it) } @@ -37,6 +43,10 @@ class JekyllPlugin : DokkaPlugin() { PackageListCreator(it, RecognizedLinkFormat.DokkaJekyll) } order { after(rootCreator) } } + + val locationProvider by extending { + dokkaBase.locationProviderFactory providing ::DokkaLocationProviderFactory override listOf(gfmPlugin.locationProvider) + } } class JekyllRenderer( |