From ba769f0695aaa9719b62ca32028fd3d24442f5ec Mon Sep 17 00:00:00 2001 From: Paweł Marks Date: Mon, 17 Feb 2020 11:27:37 +0100 Subject: Moves comments to content conversion to base plugin --- .../src/main/kotlin/KotlinAsJavaPageContentBuilder.kt | 1 + .../kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'plugins/kotlin-as-java/src/main') diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt index 02e6ff82..87649a83 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt @@ -3,6 +3,7 @@ package org.jetbrains.dokka.kotlinAsJava import org.jetbrains.dokka.base.transformers.documentables.DefaultPageContentBuilder import org.jetbrains.dokka.base.transformers.documentables.PageContentBuilderFunction import org.jetbrains.dokka.base.transformers.documentables.type +import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.Function import org.jetbrains.dokka.model.JavaTypeWrapper diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt index f8a25aca..f9389ebd 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt @@ -2,12 +2,14 @@ package org.jetbrains.dokka.kotlinAsJava import org.jetbrains.dokka.CoreExtensions +import org.jetbrains.dokka.base.DokkaBase +import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.Module import org.jetbrains.dokka.pages.ModulePageNode -import org.jetbrains.dokka.plugability.DokkaContext -import org.jetbrains.dokka.plugability.DokkaPlugin +import org.jetbrains.dokka.plugability.* import org.jetbrains.dokka.transformers.documentation.DocumentablesToPageTranslator +import org.jetbrains.dokka.utilities.DokkaLogger import org.jetbrains.kotlin.descriptors.DeclarationDescriptor class KotlinAsJavaPlugin : DokkaPlugin() { @@ -15,7 +17,7 @@ class KotlinAsJavaPlugin : DokkaPlugin() { CoreExtensions.descriptorToDocumentationTranslator providing ::KotlinAsJavaDescriptorToDocumentationTranslator } val kotlinAsJavaDocumentableToPageTranslator by extending { - CoreExtensions.documentablesToPageTranslator with KotlinAsJavaDocumentationToPageTranslator + CoreExtensions.documentablesToPageTranslator providing ::KotlinAsJavaDocumentationToPageTranslator } } @@ -26,14 +28,16 @@ object DescriptorCache { operator fun get(dri: DRI): DeclarationDescriptor? = cache[dri] } -object KotlinAsJavaDocumentationToPageTranslator : DocumentablesToPageTranslator { - override fun invoke(module: Module, context: DokkaContext): ModulePageNode = +class KotlinAsJavaDocumentationToPageTranslator( + private val context: DokkaContext +) : DocumentablesToPageTranslator { + override fun invoke(module: Module): ModulePageNode = KotlinAsJavaPageBuilder { node, kind, operation -> KotlinAsJavaPageContentBuilder.group( setOf(node.dri), node.platformData, kind, - context.single(CoreExtensions.commentsToContentConverter), + context.plugin().querySingle { commentsToContentConverter }, context.logger, operation ) -- cgit