aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/CoreExtensions.kt4
-rw-r--r--core/src/main/kotlin/DokkaGenerator.kt2
-rw-r--r--core/src/main/kotlin/plugability/DefaultExtensions.kt2
-rw-r--r--core/src/main/kotlin/transformers/documentation/DocumentablesToPageTranslator.kt (renamed from core/src/main/kotlin/transformers/documentation/DocumentationToPageTranslator.kt)2
-rw-r--r--plugins/base/src/main/kotlin/DokkaBase.kt9
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentablesToPageTranslator.kt (renamed from core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt)7
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/PageBuilder.kt (renamed from core/src/main/kotlin/pages/PageBuilder.kt)3
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/PageContentBuilder.kt (renamed from core/src/main/kotlin/pages/PageContentBuilder.kt)26
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt2
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt17
-rw-r--r--plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt6
11 files changed, 45 insertions, 35 deletions
diff --git a/core/src/main/kotlin/CoreExtensions.kt b/core/src/main/kotlin/CoreExtensions.kt
index 47f2e4c1..8ae333ee 100644
--- a/core/src/main/kotlin/CoreExtensions.kt
+++ b/core/src/main/kotlin/CoreExtensions.kt
@@ -8,7 +8,7 @@ import org.jetbrains.dokka.resolvers.LocationProviderFactory
import org.jetbrains.dokka.transformers.descriptors.DescriptorToDocumentationTranslator
import org.jetbrains.dokka.transformers.documentation.DocumentableMerger
import org.jetbrains.dokka.transformers.documentation.DocumentationNodeTransformer
-import org.jetbrains.dokka.transformers.documentation.DocumentationToPageTranslator
+import org.jetbrains.dokka.transformers.documentation.DocumentablesToPageTranslator
import org.jetbrains.dokka.transformers.pages.PageMergerStrategy
import org.jetbrains.dokka.transformers.pages.PageNodeTransformer
import org.jetbrains.dokka.transformers.psi.PsiToDocumentationTranslator
@@ -25,7 +25,7 @@ object CoreExtensions {
val documentableMerger by coreExtension<DocumentableMerger>()
val documentationTransformer by coreExtension<DocumentationNodeTransformer>()
val commentsToContentConverter by coreExtension<CommentsToContentConverter>()
- val documentationToPageTranslator by coreExtension<DocumentationToPageTranslator>()
+ val documentablesToPageTranslator by coreExtension<DocumentablesToPageTranslator>()
val pageTransformer by coreExtension<PageNodeTransformer>()
val locationProviderFactory by coreExtension<LocationProviderFactory>()
val outputWriter by coreExtension<OutputWriter>()
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt
index 1829c9e4..1ad93f4f 100644
--- a/core/src/main/kotlin/DokkaGenerator.kt
+++ b/core/src/main/kotlin/DokkaGenerator.kt
@@ -88,7 +88,7 @@ class DokkaGenerator(
fun createPages(
transformedDocumentation: Module,
context: DokkaContext
- ) = context.single(CoreExtensions.documentationToPageTranslator).invoke(transformedDocumentation, context)
+ ) = context.single(CoreExtensions.documentablesToPageTranslator).invoke(transformedDocumentation, context)
fun transformPages(
pages: RootPageNode,
diff --git a/core/src/main/kotlin/plugability/DefaultExtensions.kt b/core/src/main/kotlin/plugability/DefaultExtensions.kt
index c1a72c74..7c76afe7 100644
--- a/core/src/main/kotlin/plugability/DefaultExtensions.kt
+++ b/core/src/main/kotlin/plugability/DefaultExtensions.kt
@@ -6,7 +6,6 @@ import org.jetbrains.dokka.renderers.FileWriter
import org.jetbrains.dokka.renderers.OutputWriter
import org.jetbrains.dokka.renderers.html.HtmlRenderer
import org.jetbrains.dokka.resolvers.DefaultLocationProviderFactory
-import org.jetbrains.dokka.transformers.documentation.DefaultDocumentationToPageTranslator
import org.jetbrains.dokka.transformers.pages.DefaultPageMergerStrategy
import org.jetbrains.dokka.transformers.psi.DefaultPsiToDocumentationTranslator
import org.jetbrains.dokka.transformers.pages.DefaultPageNodeMerger
@@ -28,7 +27,6 @@ internal object DefaultExtensions {
when (point) {
CoreExtensions.psiToDocumentationTranslator -> DefaultPsiToDocumentationTranslator
CoreExtensions.commentsToContentConverter -> converter.get(fullContext)
- CoreExtensions.documentationToPageTranslator -> DefaultDocumentationToPageTranslator
CoreExtensions.pageTransformer -> DefaultPageNodeMerger(fullContext)
CoreExtensions.renderer -> renderer.get(fullContext)
CoreExtensions.locationProviderFactory -> providerFactory.get(fullContext)
diff --git a/core/src/main/kotlin/transformers/documentation/DocumentationToPageTranslator.kt b/core/src/main/kotlin/transformers/documentation/DocumentablesToPageTranslator.kt
index 08c26b19..fa74d216 100644
--- a/core/src/main/kotlin/transformers/documentation/DocumentationToPageTranslator.kt
+++ b/core/src/main/kotlin/transformers/documentation/DocumentablesToPageTranslator.kt
@@ -4,6 +4,6 @@ import org.jetbrains.dokka.model.Module
import org.jetbrains.dokka.pages.ModulePageNode
import org.jetbrains.dokka.plugability.DokkaContext
-interface DocumentationToPageTranslator {
+interface DocumentablesToPageTranslator {
operator fun invoke(module: Module, context: DokkaContext): ModulePageNode
} \ No newline at end of file
diff --git a/plugins/base/src/main/kotlin/DokkaBase.kt b/plugins/base/src/main/kotlin/DokkaBase.kt
index b18e2ad5..34c0ffae 100644
--- a/plugins/base/src/main/kotlin/DokkaBase.kt
+++ b/plugins/base/src/main/kotlin/DokkaBase.kt
@@ -3,14 +3,19 @@ package org.jetbrains.dokka.base
import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.base.transformers.descriptors.DefaultDescriptorToDocumentationTranslator
import org.jetbrains.dokka.base.transformers.documentables.DefaultDocumentableMerger
+import org.jetbrains.dokka.base.transformers.documentables.DefaultDocumentablesToPageTranslator
import org.jetbrains.dokka.plugability.DokkaPlugin
class DokkaBase: DokkaPlugin() {
- val defaultDescriptorToDocumentationTranslator by extending(isFallback = true) {
+ val descriptorToDocumentationTranslator by extending(isFallback = true) {
CoreExtensions.descriptorToDocumentationTranslator providing ::DefaultDescriptorToDocumentationTranslator
}
- val defaultDocumentableMerger by extending(isFallback = true) {
+ val documentableMerger by extending(isFallback = true) {
CoreExtensions.documentableMerger with DefaultDocumentableMerger
}
+
+ val documentablesToPageTranslator by extending(isFallback = true) {
+ CoreExtensions.documentablesToPageTranslator with DefaultDocumentablesToPageTranslator
+ }
} \ No newline at end of file
diff --git a/core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentablesToPageTranslator.kt
index c2a21150..90f8e2d7 100644
--- a/core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DefaultDocumentablesToPageTranslator.kt
@@ -1,14 +1,13 @@
-package org.jetbrains.dokka.transformers.documentation
+package org.jetbrains.dokka.base.transformers.documentables
import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.model.Module
-import org.jetbrains.dokka.pages.DefaultPageBuilder
-import org.jetbrains.dokka.pages.DefaultPageContentBuilder
import org.jetbrains.dokka.pages.ModulePageNode
import org.jetbrains.dokka.plugability.DokkaContext
+import org.jetbrains.dokka.transformers.documentation.DocumentablesToPageTranslator
-object DefaultDocumentationToPageTranslator : DocumentationToPageTranslator {
+object DefaultDocumentablesToPageTranslator : DocumentablesToPageTranslator {
override fun invoke(module: Module, context: DokkaContext): ModulePageNode =
DefaultPageBuilder { node, kind, operation ->
DefaultPageContentBuilder.group(
diff --git a/core/src/main/kotlin/pages/PageBuilder.kt b/plugins/base/src/main/kotlin/transformers/documentables/PageBuilder.kt
index eb6f5e21..29f39c73 100644
--- a/core/src/main/kotlin/pages/PageBuilder.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/PageBuilder.kt
@@ -1,9 +1,10 @@
-package org.jetbrains.dokka.pages
+package org.jetbrains.dokka.base.transformers.documentables
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.model.Enum
import org.jetbrains.dokka.model.Function
import org.jetbrains.dokka.model.doc.TagWrapper
+import org.jetbrains.dokka.pages.*
open class DefaultPageBuilder(
override val rootContentGroup: RootContentBuilder
diff --git a/core/src/main/kotlin/pages/PageContentBuilder.kt b/plugins/base/src/main/kotlin/transformers/documentables/PageContentBuilder.kt
index ed0a0fea..809b97a0 100644
--- a/core/src/main/kotlin/pages/PageContentBuilder.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/PageContentBuilder.kt
@@ -1,21 +1,21 @@
-package org.jetbrains.dokka.pages
+package org.jetbrains.dokka.base.transformers.documentables
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.Function
-import org.jetbrains.dokka.model.Parameter
import org.jetbrains.dokka.model.TypeWrapper
import org.jetbrains.dokka.model.doc.DocTag
+import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.utilities.DokkaLogger
open class DefaultPageContentBuilder(
- private val dri: Set<DRI>,
- private val platformData: Set<PlatformData>,
- private val kind: Kind,
- private val commentsConverter: CommentsToContentConverter,
- open val logger: DokkaLogger,
- private val styles: Set<Style> = emptySet(),
- private val extras: Set<Extra> = emptySet()
+ protected val dri: Set<DRI>,
+ protected val platformData: Set<PlatformData>,
+ protected val kind: Kind,
+ protected val commentsConverter: CommentsToContentConverter,
+ val logger: DokkaLogger,
+ protected val styles: Set<Style> = emptySet(),
+ protected val extras: Set<Extra> = emptySet()
) : PageContentBuilder {
protected val contents = mutableListOf<ContentNode>()
@@ -44,8 +44,8 @@ open class DefaultPageContentBuilder(
override fun signature(f: Function) = signature(f) {
text("fun ")
- if (f.receiver is Parameter) {
- type(f.receiver.type)
+ f.receiver?.also {
+ type(it.type)
text(".")
}
link(f.name, f.dri)
@@ -58,7 +58,8 @@ open class DefaultPageContentBuilder(
text(")")
val returnType = f.returnType
if (!f.isConstructor && returnType != null &&
- returnType.constructorFqName != Unit::class.qualifiedName) {
+ returnType.constructorFqName != Unit::class.qualifiedName
+ ) {
text(": ")
type(returnType)
}
@@ -189,6 +190,7 @@ interface PageContentBuilder {
platformData: Set<PlatformData>,
kind: Kind, block: PageContentBuilderFunction
): ContentGroup
+
fun text(text: String, kind: Kind = ContentKind.Symbol)
fun signature(f: Function)
fun link(text: String, address: DRI, kind: Kind = ContentKind.Symbol)
diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt
index 6fe10ce1..d4dfdaea 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageBuilder.kt
@@ -1,5 +1,7 @@
package org.jetbrains.dokka.kotlinAsJava
+import org.jetbrains.dokka.base.transformers.documentables.DefaultPageBuilder
+import org.jetbrains.dokka.base.transformers.documentables.RootContentBuilder
import org.jetbrains.dokka.kotlinAsJava.conversions.asJava
import org.jetbrains.dokka.kotlinAsJava.conversions.asStatic
import org.jetbrains.dokka.kotlinAsJava.conversions.withClass
diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt
index a5d0bd33..02e6ff82 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPageContentBuilder.kt
@@ -1,5 +1,8 @@
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.links.DRI
import org.jetbrains.dokka.model.Function
import org.jetbrains.dokka.model.JavaTypeWrapper
@@ -7,13 +10,13 @@ import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.utilities.DokkaLogger
class KotlinAsJavaPageContentBuilder(
- private val dri: Set<DRI>,
- private val platformData: Set<PlatformData>,
- private val kind: Kind,
- private val commentsConverter: CommentsToContentConverter,
- override val logger: DokkaLogger,
- private val styles: Set<Style> = emptySet(),
- private val extras: Set<Extra> = emptySet()
+ dri: Set<DRI>,
+ platformData: Set<PlatformData>,
+ kind: Kind,
+ commentsConverter: CommentsToContentConverter,
+ logger: DokkaLogger,
+ styles: Set<Style> = emptySet(),
+ extras: Set<Extra> = emptySet()
) : DefaultPageContentBuilder(dri, platformData, kind, commentsConverter, logger, styles, extras) {
override fun signature(f: Function) = signature(f) {
diff --git a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt
index dd95f00e..f8a25aca 100644
--- a/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt
+++ b/plugins/kotlin-as-java/src/main/kotlin/KotlinAsJavaPlugin.kt
@@ -7,7 +7,7 @@ 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.transformers.documentation.DocumentationToPageTranslator
+import org.jetbrains.dokka.transformers.documentation.DocumentablesToPageTranslator
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
class KotlinAsJavaPlugin : DokkaPlugin() {
@@ -15,7 +15,7 @@ class KotlinAsJavaPlugin : DokkaPlugin() {
CoreExtensions.descriptorToDocumentationTranslator providing ::KotlinAsJavaDescriptorToDocumentationTranslator
}
val kotlinAsJavaDocumentableToPageTranslator by extending {
- CoreExtensions.documentationToPageTranslator with KotlinAsJavaDocumentationToPageTranslator
+ CoreExtensions.documentablesToPageTranslator with KotlinAsJavaDocumentationToPageTranslator
}
}
@@ -26,7 +26,7 @@ object DescriptorCache {
operator fun get(dri: DRI): DeclarationDescriptor? = cache[dri]
}
-object KotlinAsJavaDocumentationToPageTranslator : DocumentationToPageTranslator {
+object KotlinAsJavaDocumentationToPageTranslator : DocumentablesToPageTranslator {
override fun invoke(module: Module, context: DokkaContext): ModulePageNode =
KotlinAsJavaPageBuilder { node, kind, operation ->
KotlinAsJavaPageContentBuilder.group(