aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt3
-rw-r--r--plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt16
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt31
3 files changed, 24 insertions, 26 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 365405ed..7f953c57 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -199,6 +199,9 @@ open class HtmlRenderer(
}
override fun FlowContent.buildText(textNode: ContentText) {
+ when{
+ textNode.style.contains(TextStyle.Indented) -> consumer.onTagContentEntity(Entities.nbsp)
+ }
text(textNode.text)
}
diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
index 31cd0eca..8d925376 100644
--- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
+++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt
@@ -33,7 +33,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
private fun signature(c: DClasslike) = contentBuilder.contentFor(c, ContentKind.Symbol, setOf(TextStyle.Monospace)) {
platformText(c.visibility) { (it.takeIf { it !in ignoredVisibilities }?.name ?: "") + " " }
if (c is DClass) {
- if (c.extra[AdditionalModifiers.AdditionalKey]?.content?.contains(ExtraModifiers.DATA) == true) {
+ if (c.extra[AdditionalModifiers]?.content?.contains(ExtraModifiers.DATA) == true) {
text("data ")
} else {
text(c.modifier.name + " ")
@@ -47,15 +47,13 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog
is DAnnotation -> text("annotation class ")
}
link(c.name!!, c.dri)
- if(c is Class){
+ if(c is DClass){
val pConstructor = c.constructors.singleOrNull() { it.extra[PrimaryConstructorExtra.PrimaryConstructorExtraKey] != null }
- if(pConstructor != null) {
- list(pConstructor.parameters, "(", ")", ",", pConstructor.platformData.toSet()){
- breakLine()
- text(it.name ?: "", styles = mainStyles.plus(TextStyle.Bold))
- text(": ")
- signatureForProjection(it.type)
- }
+ list(pConstructor?.parameters.orEmpty(), "(", ")", ",", pConstructor?.platformData.orEmpty().toSet()){
+ breakLine()
+ text(it.name ?: "", styles = mainStyles.plus(TextStyle.Bold).plus(TextStyle.Indented))
+ text(": ")
+ signatureForProjection(it.type)
}
}
if (c is WithSupertypes) {
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index bd21f9df..c30d99b7 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -296,7 +296,9 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
modifier = descriptor.modifier(),
generics = descriptor.typeParameters.map { it.toTypeParameter() },
platformData = listOf(platformData),
- extra = PropertyContainer.withAll(descriptor.additionalExtras(), descriptor.getAnnotations())
+ extra = PropertyContainer.withAll<DFunction>(descriptor.additionalExtras(), descriptor.getAnnotations()).let {
+ if(descriptor.isPrimary) { it + PrimaryConstructorExtra } else it
+ }
)
}
@@ -475,23 +477,18 @@ private class DokkaDescriptorVisitor( // TODO: close this class and make it priv
} else {
PlatformDependent(mapOf(platformData to DescriptorDocumentableSource(this)))
}
-
+
fun FunctionDescriptor.additionalExtras() = listOfNotNull(
- ExtraModifiers.DYNAMIC.takeIf { isDynamic() },
- ExtraModifiers.INFIX.takeIf { isInfix },
- ExtraModifiers.INLINE.takeIf { isInline },
- ExtraModifiers.SUSPEND.takeIf { isSuspend },
- ExtraModifiers.OPERATOR.takeIf { isOperator },
- ExtraModifiers.STATIC.takeIf { isJvmStaticInObjectOrClassOrInterface() },
- ExtraModifiers.TAILREC.takeIf { isTailrec },
- ExtraModifiers.EXTERNAL.takeIf { isExternal },
- ExtraModifiers.OVERRIDE.takeIf { DescriptorUtils.isOverride(this) }
- ).toProperty()
-
- inline fun <reified D : Documentable> ConstructorDescriptor.additionalExtras(): PropertyContainer<D> =
- if(this.isPrimary)
- (this as FunctionDescriptor).additionalExtras<D>() + PrimaryConstructorExtra
- else (this as FunctionDescriptor).additionalExtras()
+ ExtraModifiers.DYNAMIC.takeIf { isDynamic() },
+ ExtraModifiers.INFIX.takeIf { isInfix },
+ ExtraModifiers.INLINE.takeIf { isInline },
+ ExtraModifiers.SUSPEND.takeIf { isSuspend },
+ ExtraModifiers.OPERATOR.takeIf { isOperator },
+ ExtraModifiers.STATIC.takeIf { isJvmStaticInObjectOrClassOrInterface() },
+ ExtraModifiers.TAILREC.takeIf { isTailrec },
+ ExtraModifiers.EXTERNAL.takeIf { isExternal },
+ ExtraModifiers.OVERRIDE.takeIf { DescriptorUtils.isOverride(this) }
+ ).toProperty()
fun ClassDescriptor.additionalExtras() = listOfNotNull(
ExtraModifiers.DYNAMIC.takeIf { isDynamic() },