aboutsummaryrefslogtreecommitdiff
path: root/plugins/gfm/gfm-template-processing/src/main
diff options
context:
space:
mode:
authorBłażej Kardyś <bkardys@virtuslab.com>2021-01-05 17:59:38 +0100
committerGitHub <noreply@github.com>2021-01-05 17:59:38 +0100
commit1618e552c136e25d86bf0708e0d760841c77c139 (patch)
treec608ce91b020bb0ecbfe75d0f456a0eae84b4c51 /plugins/gfm/gfm-template-processing/src/main
parentef98e4b6505c3fdd192b1d5057c718079d27b972 (diff)
downloaddokka-1618e552c136e25d86bf0708e0d760841c77c139.tar.gz
dokka-1618e552c136e25d86bf0708e0d760841c77c139.tar.bz2
dokka-1618e552c136e25d86bf0708e0d760841c77c139.zip
Versioning (#1654)
* Adding versioning mechanism for multimodule * Versioning improvement * Refactor configuration, add ordering * Fix integration tests * Change packages, unignore test Co-authored-by: Marcin Aman <marcin.aman@gmail.com>
Diffstat (limited to 'plugins/gfm/gfm-template-processing/src/main')
-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
2 files changed, 21 insertions, 25 deletions
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 {