From be932e200951e5b043f2e04e18b60176ac876156 Mon Sep 17 00:00:00 2001 From: Błażej Kardyś Date: Wed, 23 Sep 2020 11:47:52 +0200 Subject: Addding separate pages for properties --- .../src/main/kotlin/KotlinAsJavaPlugin.kt | 13 ++++++++++++- .../KotlinAsJavaDocumentableToPageTranslator.kt | 17 +++++++++++++++++ .../main/kotlin/translators/KotlinAsJavaPageCreator.kt | 16 ++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaDocumentableToPageTranslator.kt create mode 100644 plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaPageCreator.kt (limited to 'plugins/kotlin-as-java') diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt index 5f06852e..04a63fca 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt @@ -4,10 +4,11 @@ import org.jetbrains.dokka.CoreExtensions import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.kotlinAsJava.signatures.JavaSignatureProvider import org.jetbrains.dokka.kotlinAsJava.transformers.KotlinAsJavaDocumentableTransformer +import org.jetbrains.dokka.kotlinAsJava.translators.KotlinAsJavaDocumentableToPageTranslator import org.jetbrains.dokka.plugability.DokkaPlugin class KotlinAsJavaPlugin : DokkaPlugin() { - val kotlinAsJavaDocumentableToPageTranslator by extending { + val kotlinAsJavaDocumentableTransformer by extending { CoreExtensions.documentableTransformer with KotlinAsJavaDocumentableTransformer() } val javaSignatureProvider by extending { @@ -16,4 +17,14 @@ class KotlinAsJavaPlugin : DokkaPlugin() { JavaSignatureProvider(ctx.single(dokkaBasePlugin.commentsToContentConverter), ctx.logger) } override dokkaBasePlugin.kotlinSignatureProvider } + val kotlinAsJavaDocumentableToPageTranslator by extending { + val dokkaBasePlugin = plugin() + CoreExtensions.documentableToPageTranslator providing { ctx -> + KotlinAsJavaDocumentableToPageTranslator( + ctx.single(dokkaBasePlugin.commentsToContentConverter), + ctx.single(dokkaBasePlugin.signatureProvider), + ctx.logger + ) + } override dokkaBasePlugin.documentableToPageTranslator + } } \ No newline at end of file diff --git a/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaDocumentableToPageTranslator.kt b/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaDocumentableToPageTranslator.kt new file mode 100644 index 00000000..cfb4daa3 --- /dev/null +++ b/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaDocumentableToPageTranslator.kt @@ -0,0 +1,17 @@ +package org.jetbrains.dokka.kotlinAsJava.translators + +import org.jetbrains.dokka.base.signatures.SignatureProvider +import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter +import org.jetbrains.dokka.transformers.documentation.DocumentableToPageTranslator +import org.jetbrains.dokka.model.DModule +import org.jetbrains.dokka.pages.ModulePageNode +import org.jetbrains.dokka.utilities.DokkaLogger + +class KotlinAsJavaDocumentableToPageTranslator( + private val commentsToContentConverter: CommentsToContentConverter, + private val signatureProvider: SignatureProvider, + private val logger: DokkaLogger +) : DocumentableToPageTranslator { + override fun invoke(module: DModule): ModulePageNode = + KotlinAsJavaPageCreator(commentsToContentConverter, signatureProvider, logger).pageForModule(module) +} \ No newline at end of file diff --git a/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaPageCreator.kt b/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaPageCreator.kt new file mode 100644 index 00000000..de998c55 --- /dev/null +++ b/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaPageCreator.kt @@ -0,0 +1,16 @@ +package org.jetbrains.dokka.kotlinAsJava.translators + +import org.jetbrains.dokka.base.signatures.SignatureProvider +import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter +import org.jetbrains.dokka.base.translators.documentables.DefaultPageCreator +import org.jetbrains.dokka.model.DProperty +import org.jetbrains.dokka.pages.MemberPageNode +import org.jetbrains.dokka.utilities.DokkaLogger + +class KotlinAsJavaPageCreator( + commentsToContentConverter: CommentsToContentConverter, + signatureProvider: SignatureProvider, + logger: DokkaLogger +) : DefaultPageCreator(commentsToContentConverter, signatureProvider, logger) { + override fun pageForProperty(p: DProperty): MemberPageNode? = null +} \ No newline at end of file -- cgit