Skip to content

Commit

Permalink
Change jekyll links to be .html
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinAman authored and kamildoleglo committed Jul 6, 2021
1 parent 46b3371 commit 1e0454d
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
1 change: 1 addition & 0 deletions plugins/jekyll/api/jekyll.api
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}

17 changes: 17 additions & 0 deletions plugins/jekyll/jekyll-template-processing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.jetbrains.dokka.gfm.templateProcessing.JekyllTemplateProcessingPlugin
10 changes: 10 additions & 0 deletions plugins/jekyll/src/main/kotlin/JekyllPlugin.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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) }
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ open class DokkaPlugin : Plugin<Project> {
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"
}
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 1e0454d

Please sign in to comment.