aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/renderers/DefaultRenderer.kt
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2019-12-13 14:27:25 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-01-16 11:55:53 +0100
commit0917459a2eafabc563e79579a0322bb7832cae1f (patch)
treea5ac67c7595232a28af27716711bee644d3a12f3 /core/src/main/kotlin/renderers/DefaultRenderer.kt
parent9e69d2db272b2ebe9317b88ce222473c4df355af (diff)
downloaddokka-0917459a2eafabc563e79579a0322bb7832cae1f.tar.gz
dokka-0917459a2eafabc563e79579a0322bb7832cae1f.tar.bz2
dokka-0917459a2eafabc563e79579a0322bb7832cae1f.zip
Refactor of DokkaGenerator pipeline, removed ExtensionPoints dependencies other than context
Diffstat (limited to 'core/src/main/kotlin/renderers/DefaultRenderer.kt')
-rw-r--r--core/src/main/kotlin/renderers/DefaultRenderer.kt14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/src/main/kotlin/renderers/DefaultRenderer.kt b/core/src/main/kotlin/renderers/DefaultRenderer.kt
index 8f6c6635..5f982251 100644
--- a/core/src/main/kotlin/renderers/DefaultRenderer.kt
+++ b/core/src/main/kotlin/renderers/DefaultRenderer.kt
@@ -1,15 +1,20 @@
package org.jetbrains.dokka.renderers
+import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
+import org.jetbrains.dokka.plugability.single
import org.jetbrains.dokka.resolvers.LocationProvider
+
abstract class DefaultRenderer<T>(
- protected val writer: Writer,
- protected val locationProvider: LocationProvider,
+ protected val outputWriter: OutputWriter,
protected val context: DokkaContext
) : Renderer {
+ protected lateinit var locationProvider: LocationProvider
+ private set
+
protected abstract fun T.buildHeader(level: Int, content: T.() -> Unit)
protected abstract fun T.buildLink(address: String, content: T.() -> Unit)
protected abstract fun T.buildList(node: ContentList, pageContext: PageNode)
@@ -64,7 +69,7 @@ abstract class DefaultRenderer<T>(
}
protected open fun renderPage(page: PageNode) =
- writer.write(locationProvider.resolve(page), buildPage(page, ::buildPageContent), "")
+ outputWriter.write(locationProvider.resolve(page), buildPage(page, ::buildPageContent), "")
protected open fun renderPages(root: PageNode) {
renderPage(root)
@@ -77,7 +82,7 @@ abstract class DefaultRenderer<T>(
getPackageNamesAndPlatforms(root)
.keys
.joinToString("\n")
- .also { writer.write("${root.name}/package-list", it, "") }
+ .also { outputWriter.write("${root.name}/package-list", it, "") }
protected open fun getPackageNamesAndPlatforms(root: PageNode): Map<String, List<PlatformData>> =
root.children
@@ -90,6 +95,7 @@ abstract class DefaultRenderer<T>(
}
override fun render(root: PageNode) {
+ locationProvider = context.single(CoreExtensions.locationProviderFactory).getLocationProvider(root, context)
renderPackageList(root)
buildSupportFiles()
renderPages(root)