aboutsummaryrefslogtreecommitdiff
path: root/plugins/gfm
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/gfm')
-rw-r--r--plugins/gfm/gfm-template-processing/build.gradle.kts1
-rw-r--r--plugins/gfm/gfm-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/GfmTemplateProcessingPlugin.kt6
-rw-r--r--plugins/gfm/gfm-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/GfmTemplateProcessingStrategy.kt40
3 files changed, 22 insertions, 25 deletions
diff --git a/plugins/gfm/gfm-template-processing/build.gradle.kts b/plugins/gfm/gfm-template-processing/build.gradle.kts
index f95ef0e4..b401c0c7 100644
--- a/plugins/gfm/gfm-template-processing/build.gradle.kts
+++ b/plugins/gfm/gfm-template-processing/build.gradle.kts
@@ -4,6 +4,7 @@ dependencies {
implementation(project(":plugins:base"))
implementation(project(":plugins:gfm"))
implementation(project(":plugins:all-modules-page"))
+ implementation(project(":plugins:templating"))
val coroutines_version: String by project
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
diff --git a/plugins/gfm/gfm-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/GfmTemplateProcessingPlugin.kt b/plugins/gfm/gfm-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/GfmTemplateProcessingPlugin.kt
index 7df740a5..ba08bcd2 100644
--- a/plugins/gfm/gfm-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/GfmTemplateProcessingPlugin.kt
+++ b/plugins/gfm/gfm-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/GfmTemplateProcessingPlugin.kt
@@ -6,19 +6,21 @@ import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.gfm.GfmPlugin
import org.jetbrains.dokka.gfm.location.MarkdownLocationProvider
import org.jetbrains.dokka.plugability.DokkaPlugin
+import org.jetbrains.dokka.templates.TemplatingPlugin
class GfmTemplateProcessingPlugin : DokkaPlugin() {
private val allModulesPagePlugin by lazy { plugin<AllModulesPagePlugin>() }
+ private val templateProcessingPlugin by lazy { plugin<TemplatingPlugin>() }
private val gfmPlugin by lazy { plugin<GfmPlugin>() }
private val dokkaBase by lazy { plugin<DokkaBase>()}
val gfmTemplateProcessingStrategy by extending {
- (allModulesPagePlugin.templateProcessingStrategy
+ (templateProcessingPlugin.templateProcessingStrategy
providing ::GfmTemplateProcessingStrategy
- order { before(allModulesPagePlugin.fallbackProcessingStrategy) })
+ order { before(templateProcessingPlugin.fallbackProcessingStrategy) })
}
val gfmLocationProvider by extending {
diff --git a/plugins/gfm/gfm-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/GfmTemplateProcessingStrategy.kt b/plugins/gfm/gfm-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/GfmTemplateProcessingStrategy.kt
index 3f2bbd3e..93ce9659 100644
--- a/plugins/gfm/gfm-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/GfmTemplateProcessingStrategy.kt
+++ b/plugins/gfm/gfm-template-processing/src/main/kotlin/org/jetbrains/dokka/gfm/templateProcessing/GfmTemplateProcessingStrategy.kt
@@ -1,10 +1,6 @@
package org.jetbrains.dokka.gfm.templateProcessing
-import kotlinx.coroutines.Dispatchers.IO
-import kotlinx.coroutines.coroutineScope
-import kotlinx.coroutines.launch
import org.jetbrains.dokka.allModulesPage.AllModulesPagePlugin
-import org.jetbrains.dokka.allModulesPage.templates.TemplateProcessingStrategy
import org.jetbrains.dokka.base.templating.parseJson
import org.jetbrains.dokka.gfm.GfmCommand
import org.jetbrains.dokka.gfm.GfmCommand.Companion.command
@@ -15,6 +11,7 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.plugin
import org.jetbrains.dokka.plugability.querySingle
+import org.jetbrains.dokka.templates.TemplateProcessingStrategy
import java.io.BufferedWriter
import java.io.File
@@ -23,33 +20,30 @@ class GfmTemplateProcessingStrategy(val context: DokkaContext) : TemplateProcess
private val externalModuleLinkResolver =
context.plugin<AllModulesPagePlugin>().querySingle { externalModuleLinkResolver }
- override suspend fun process(input: File, output: File): Boolean = coroutineScope {
+ override fun process(input: File, output: File): Boolean =
if (input.extension == "md") {
- launch(IO) {
- input.bufferedReader().use { reader ->
- //This should also work whenever we have a misconfigured dokka and output is pointing to the input
- //the same way that html processing does
- if (input.absolutePath == output.absolutePath) {
- context.logger.info("Attempting to process GFM templates in place for directory $input, this suggests miss configuration.")
- val lines = reader.readLines()
- output.bufferedWriter().use { writer ->
- lines.forEach { line ->
- writer.processAndWrite(line, output)
- }
-
+ input.bufferedReader().use { reader ->
+ //This should also work whenever we have a misconfigured dokka and output is pointing to the input
+ //the same way that html processing does
+ if (input.absolutePath == output.absolutePath) {
+ context.logger.info("Attempting to process GFM templates in place for directory $input, this suggests miss configuration.")
+ val lines = reader.readLines()
+ output.bufferedWriter().use { writer ->
+ lines.forEach { line ->
+ writer.processAndWrite(line, output)
}
- } else {
- output.bufferedWriter().use { writer ->
- reader.lineSequence().forEach { line ->
- writer.processAndWrite(line, output)
- }
+
+ }
+ } else {
+ output.bufferedWriter().use { writer ->
+ reader.lineSequence().forEach { line ->
+ writer.processAndWrite(line, output)
}
}
}
}
true
} else false
- }
private fun BufferedWriter.processAndWrite(line: String, output: File) =
processLine(line, output).run {