aboutsummaryrefslogtreecommitdiff
path: root/plugins/gfm
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-04-06 15:58:55 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-04-22 13:10:48 +0200
commit720c50fb7f4bf4ae4b4d4c406cfb958a7fba8ffb (patch)
tree10869d6dcbd5af8599b2091fc6581ce6b16a47d5 /plugins/gfm
parent58126c324c30fff4f65fef7cc72aa715364ef358 (diff)
downloaddokka-720c50fb7f4bf4ae4b4d4c406cfb958a7fba8ffb.tar.gz
dokka-720c50fb7f4bf4ae4b4d4c406cfb958a7fba8ffb.tar.bz2
dokka-720c50fb7f4bf4ae4b4d4c406cfb958a7fba8ffb.zip
Adds asynchronous rendering
Diffstat (limited to 'plugins/gfm')
-rw-r--r--plugins/gfm/src/main/kotlin/GfmPlugin.kt9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/gfm/src/main/kotlin/GfmPlugin.kt b/plugins/gfm/src/main/kotlin/GfmPlugin.kt
index 91b6f7b5..185dacac 100644
--- a/plugins/gfm/src/main/kotlin/GfmPlugin.kt
+++ b/plugins/gfm/src/main/kotlin/GfmPlugin.kt
@@ -1,5 +1,6 @@
package org.jetbrains.dokka.gfm
+import kotlinx.coroutines.*
import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.DefaultRenderer
@@ -108,7 +109,7 @@ open class CommonmarkRenderer(
override fun StringBuilder.buildPlatformDependent(content: PlatformHintedContent, pageContext: ContentPage) {
val distinct = content.platforms.map {
- it to "${StringBuilder().apply {buildContentNode(content.inner, pageContext, it) }.toString()}"
+ it to StringBuilder().apply {buildContentNode(content.inner, pageContext, it) }.toString()
}.groupBy(Pair<PlatformData, String>::second, Pair<PlatformData, String>::first)
if (distinct.size == 1)
@@ -200,14 +201,14 @@ open class CommonmarkRenderer(
append(to.name)
}
- override fun renderPage(page: PageNode) {
+ override suspend fun renderPage(page: PageNode) {
val path by lazy { locationProvider.resolve(page, skipExtension = true) }
when (page) {
- is ContentPage -> outputWriter.write(path, buildPage(page) { c, p -> buildPageContent(c, p) }, ".md")
+ is ContentPage -> outputWriter.write(path, buildPage(page) { c, p -> runBlocking { buildPageContent(c, p) } }, ".md")
is RendererSpecificPage -> when (val strategy = page.strategy) {
is RenderingStrategy.Copy -> outputWriter.writeResources(strategy.from, path)
is RenderingStrategy.Write -> outputWriter.write(path, strategy.text, "")
- is RenderingStrategy.Callback -> outputWriter.write(path, strategy.instructions(this, page), ".md")
+ is RenderingStrategy.Callback -> outputWriter.write(path, strategy.instructions(this@CommonmarkRenderer, page), ".md")
RenderingStrategy.DoNothing -> Unit
}
else -> throw AssertionError(