aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/src/test/kotlin/utils/TestOutputWriter.kt16
-rw-r--r--plugins/gfm/src/main/kotlin/GfmPlugin.kt35
-rw-r--r--plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt13
-rw-r--r--plugins/jekyll/src/main/kotlin/JekyllPlugin.kt6
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt8
5 files changed, 45 insertions, 33 deletions
diff --git a/plugins/base/src/test/kotlin/utils/TestOutputWriter.kt b/plugins/base/src/test/kotlin/utils/TestOutputWriter.kt
index 46ada43a..83f1d180 100644
--- a/plugins/base/src/test/kotlin/utils/TestOutputWriter.kt
+++ b/plugins/base/src/test/kotlin/utils/TestOutputWriter.kt
@@ -3,15 +3,20 @@ package utils
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.OutputWriter
import org.jetbrains.dokka.plugability.DokkaPlugin
-import java.io.File
-class TestOutputWriterPlugin(failOnOverwrite: Boolean = true): DokkaPlugin() {
+class TestOutputWriterPlugin(failOnOverwrite: Boolean = true) : DokkaPlugin() {
val writer = TestOutputWriter(failOnOverwrite)
- val testWriter by extending { plugin<DokkaBase>().outputWriter with writer }
+ private val dokkaBase by lazy { plugin<DokkaBase>() }
+
+ val testWriter by extending {
+ (dokkaBase.outputWriter
+ with writer
+ override dokkaBase.fileWriter)
+ }
}
-class TestOutputWriter(private val failOnOverwrite: Boolean = true): OutputWriter {
+class TestOutputWriter(private val failOnOverwrite: Boolean = true) : OutputWriter {
val contents: Map<String, String> get() = _contents
private val _contents = mutableMapOf<String, String>()
@@ -23,5 +28,6 @@ class TestOutputWriter(private val failOnOverwrite: Boolean = true): OutputWrite
}
}
- override suspend fun writeResources(pathFrom: String, pathTo: String) = write(pathTo, "*** content of $pathFrom ***", "")
+ override suspend fun writeResources(pathFrom: String, pathTo: String) =
+ write(pathTo, "*** content of $pathFrom ***", "")
}
diff --git a/plugins/gfm/src/main/kotlin/GfmPlugin.kt b/plugins/gfm/src/main/kotlin/GfmPlugin.kt
index 287ef74f..32c0b7b7 100644
--- a/plugins/gfm/src/main/kotlin/GfmPlugin.kt
+++ b/plugins/gfm/src/main/kotlin/GfmPlugin.kt
@@ -19,12 +19,20 @@ class GfmPlugin : DokkaPlugin() {
val gfmPreprocessors by extensionPoint<PageTransformer>()
+ private val dokkaBase by lazy { plugin<DokkaBase>() }
+
val renderer by extending {
- CoreExtensions.renderer providing { CommonmarkRenderer(it) } applyIf { format == "gfm" }
+ (CoreExtensions.renderer
+ providing { CommonmarkRenderer(it) }
+ applyIf { format == "gfm" }
+ override dokkaBase.htmlRenderer)
}
val locationProvider by extending {
- plugin<DokkaBase>().locationProviderFactory providing { MarkdownLocationProviderFactory(it) } applyIf { format == "gfm" }
+ (dokkaBase.locationProviderFactory
+ providing { MarkdownLocationProviderFactory(it) }
+ applyIf { format == "gfm" }
+ override dokkaBase.locationProvider)
}
val rootCreator by extending {
@@ -32,13 +40,9 @@ class GfmPlugin : DokkaPlugin() {
}
val packageListCreator by extending {
- gfmPreprocessors providing {
- PackageListCreator(
- it,
- "gfm",
- "md"
- )
- } order { after(rootCreator) }
+ (gfmPreprocessors
+ providing { PackageListCreator(it, "gfm", "md") }
+ order { after(rootCreator) })
}
}
@@ -128,7 +132,7 @@ open class CommonmarkRenderer(
sourceSets: Set<DokkaSourceSet>,
pageContext: ContentPage,
) {
- if(content is ContentGroup && content.children.firstOrNull{ it is ContentTable } != null){
+ if (content is ContentGroup && content.children.firstOrNull { it is ContentTable } != null) {
buildContentNode(content, pageContext)
} else {
val distinct = sourceSets.map {
@@ -155,11 +159,16 @@ open class CommonmarkRenderer(
pageContext: ContentPage,
sourceSetRestriction: Set<DokkaSourceSet>?
) {
- if(node.dci.kind == ContentKind.Sample || node.dci.kind == ContentKind.Parameters){
- node.sourceSets.forEach {sourcesetData ->
+ if (node.dci.kind == ContentKind.Sample || node.dci.kind == ContentKind.Parameters) {
+ node.sourceSets.forEach { sourcesetData ->
append("${sourcesetData.moduleDisplayName}/${sourcesetData.sourceSetID}")
buildNewLine()
- buildTable(node.copy(children = node.children.filter { it.sourceSets.contains(sourcesetData) }, dci = node.dci.copy(kind = ContentKind.Main)), pageContext, sourceSetRestriction)
+ buildTable(
+ node.copy(
+ children = node.children.filter { it.sourceSets.contains(sourcesetData) },
+ dci = node.dci.copy(kind = ContentKind.Main)
+ ), pageContext, sourceSetRestriction
+ )
buildNewLine()
}
} else {
diff --git a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt
index 6e467542..7b4aa64d 100644
--- a/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt
+++ b/plugins/javadoc/src/main/kotlin/javadoc/JavadocPlugin.kt
@@ -15,13 +15,10 @@ class JavadocPlugin : DokkaPlugin() {
val locationProviderFactory by extensionPoint<JavadocLocationProviderFactory>()
val dokkaJavadocPlugin by extending {
- CoreExtensions.renderer providing { ctx ->
- KorteJavadocRenderer(
- dokkaBasePlugin.querySingle { outputWriter },
- ctx,
- "views"
- )
- } applyIf { format == "javadoc" }
+ (CoreExtensions.renderer
+ providing { ctx -> KorteJavadocRenderer(dokkaBasePlugin.querySingle { outputWriter }, ctx, "views") }
+ applyIf { format == "javadoc" }
+ override dokkaBasePlugin.htmlRenderer)
}
val pageTranslator by extending {
@@ -31,7 +28,7 @@ class JavadocPlugin : DokkaPlugin() {
dokkaBasePlugin.querySingle { signatureProvider },
context.logger
)
- }
+ } override dokkaBasePlugin.documentableToPageTranslator
}
val javadocLocationProviderFactory by extending {
diff --git a/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt b/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt
index b9f5e1a5..ad83ca76 100644
--- a/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt
+++ b/plugins/jekyll/src/main/kotlin/JekyllPlugin.kt
@@ -1,6 +1,7 @@
package org.jetbrains.dokka.jekyll
import org.jetbrains.dokka.CoreExtensions
+import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.PackageListCreator
import org.jetbrains.dokka.base.renderers.RootCreator
import org.jetbrains.dokka.gfm.CommonmarkRenderer
@@ -18,7 +19,10 @@ class JekyllPlugin : DokkaPlugin() {
val jekyllPreprocessors by extensionPoint<PageTransformer>()
val renderer by extending {
- CoreExtensions.renderer providing { JekyllRenderer(it) } applyIf { format == "jekyll" }
+ (CoreExtensions.renderer
+ providing { JekyllRenderer(it) }
+ applyIf { format == "jekyll" }
+ override plugin<DokkaBase>().htmlRenderer)
}
val rootCreator by extending {
diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt
index bf9b8dc0..5f06852e 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt
@@ -13,11 +13,7 @@ class KotlinAsJavaPlugin : DokkaPlugin() {
val javaSignatureProvider by extending {
val dokkaBasePlugin = plugin<DokkaBase>()
dokkaBasePlugin.signatureProvider providing { ctx ->
- JavaSignatureProvider(
- ctx.single(
- dokkaBasePlugin.commentsToContentConverter
- ), ctx.logger
- )
- }
+ JavaSignatureProvider(ctx.single(dokkaBasePlugin.commentsToContentConverter), ctx.logger)
+ } override dokkaBasePlugin.kotlinSignatureProvider
}
} \ No newline at end of file