aboutsummaryrefslogtreecommitdiff
path: root/plugins/kotlin-as-java/src/main/kotlin
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2022-02-17 14:51:14 +0300
committerGitHub <noreply@github.com>2022-02-17 14:51:14 +0300
commit13b87181219f5a96e499c6bda230f6bcd2ed3bc0 (patch)
tree7618b9fedeed0b2228017aee8f0754834223c5fc /plugins/kotlin-as-java/src/main/kotlin
parent2372302f4bc3b4bf49beb0d477eebdd9ac99a78f (diff)
downloaddokka-13b87181219f5a96e499c6bda230f6bcd2ed3bc0.tar.gz
dokka-13b87181219f5a96e499c6bda230f6bcd2ed3bc0.tar.bz2
dokka-13b87181219f5a96e499c6bda230f6bcd2ed3bc0.zip
Custom doctag extension (#2343)
* Add an extension point for rendering custom doc tags * Iterate over documentable sourcesets when building custom tags * Extract a nested custom tags brief block into a separate method * Filter out tag content providers and make since kotlin brief a one-liner * Add padding to "Since Kotlin" block in brief description
Diffstat (limited to 'plugins/kotlin-as-java/src/main/kotlin')
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaDocumentableToPageTranslator.kt14
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaPageCreator.kt12
2 files changed, 19 insertions, 7 deletions
diff --git a/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaDocumentableToPageTranslator.kt b/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaDocumentableToPageTranslator.kt
index 0f7d74b6..f1aae2dc 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaDocumentableToPageTranslator.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaDocumentableToPageTranslator.kt
@@ -8,18 +8,22 @@ import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.transformers.documentation.DocumentableToPageTranslator
import org.jetbrains.dokka.model.DModule
import org.jetbrains.dokka.pages.ModulePageNode
-import org.jetbrains.dokka.plugability.configuration
-import org.jetbrains.dokka.plugability.DokkaContext
-import org.jetbrains.dokka.plugability.plugin
-import org.jetbrains.dokka.plugability.querySingle
+import org.jetbrains.dokka.plugability.*
import org.jetbrains.dokka.utilities.DokkaLogger
class KotlinAsJavaDocumentableToPageTranslator(context: DokkaContext) : DocumentableToPageTranslator {
private val configuration = configuration<DokkaBase, DokkaBaseConfiguration>(context)
private val commentsToContentConverter = context.plugin<DokkaBase>().querySingle { commentsToContentConverter }
private val signatureProvider = context.plugin<DokkaBase>().querySingle { signatureProvider }
+ private val customTagContentProviders = context.plugin<DokkaBase>().query { customTagContentProvider }
private val logger: DokkaLogger = context.logger
override fun invoke(module: DModule): ModulePageNode =
- KotlinAsJavaPageCreator(configuration, commentsToContentConverter, signatureProvider, logger).pageForModule(module)
+ KotlinAsJavaPageCreator(
+ configuration,
+ commentsToContentConverter,
+ signatureProvider,
+ logger,
+ customTagContentProviders
+ ).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
index b2cf6246..ef075153 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaPageCreator.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/translators/KotlinAsJavaPageCreator.kt
@@ -5,6 +5,7 @@ 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.DokkaConfiguration
+import org.jetbrains.dokka.base.transformers.pages.tags.CustomTagContentProvider
import org.jetbrains.dokka.model.DProperty
import org.jetbrains.dokka.pages.MemberPageNode
import org.jetbrains.dokka.utilities.DokkaLogger
@@ -13,7 +14,14 @@ class KotlinAsJavaPageCreator(
configuration: DokkaBaseConfiguration?,
commentsToContentConverter: CommentsToContentConverter,
signatureProvider: SignatureProvider,
- logger: DokkaLogger
-) : DefaultPageCreator(configuration, commentsToContentConverter, signatureProvider, logger) {
+ logger: DokkaLogger,
+ customTagContentProviders: List<CustomTagContentProvider>
+) : DefaultPageCreator(
+ configuration,
+ commentsToContentConverter,
+ signatureProvider,
+ logger,
+ customTagContentProviders = customTagContentProviders
+) {
override fun pageForProperty(p: DProperty): MemberPageNode? = null
} \ No newline at end of file