diff options
author | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2021-05-28 13:38:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-28 13:38:20 +0200 |
commit | 0c48894b5cb0e9dd20706a14f268219b34e18531 (patch) | |
tree | afdfb2ca02240a00bfa50cb9d1773cb4cf242b6d /plugins/gfm/src/main/kotlin | |
parent | 50350aa305d6831a1298932b59504a626aecdcc5 (diff) | |
download | dokka-0c48894b5cb0e9dd20706a14f268219b34e18531.tar.gz dokka-0c48894b5cb0e9dd20706a14f268219b34e18531.tar.bz2 dokka-0c48894b5cb0e9dd20706a14f268219b34e18531.zip |
Add all rendering strategies to CommonMark renderer and enforce exhaustive matches (#1944)
Diffstat (limited to 'plugins/gfm/src/main/kotlin')
-rw-r--r-- | plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt index ac6cdaa8..676b0606 100644 --- a/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt +++ b/plugins/gfm/src/main/kotlin/org/jetbrains/dokka/gfm/renderer/CommonmarkRenderer.kt @@ -330,12 +330,26 @@ open class CommonmarkRenderer( ?: throw DokkaException("Cannot resolve path for ${page.name}") } - when (page) { + return when (page) { is ContentPage -> outputWriter.write(path, buildPage(page) { c, p -> 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.DriLocationResolvableWrite -> outputWriter.write( + path, + strategy.contentToResolve { dri, sourcesets -> + locationProvider.resolve(dri, sourcesets) + }, + "" + ) + is RenderingStrategy.PageLocationResolvableWrite -> outputWriter.write( + path, + strategy.contentToResolve { pageToLocate, context -> + locationProvider.resolve(pageToLocate, context) + }, + "" + ) RenderingStrategy.DoNothing -> Unit } else -> throw AssertionError( |