diff options
Diffstat (limited to 'plugins/base/src/main/kotlin/translators')
3 files changed, 23 insertions, 16 deletions
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index ceb4d0bd..b7dfccd2 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -405,14 +405,18 @@ private class DokkaDescriptorVisitor( } override fun visitTypeAliasDescriptor(descriptor: TypeAliasDescriptor, parent: DRIWithPlatformInfo?) = - DTypeAlias( - dri = DRI.from(descriptor), - name = descriptor.name.asString(), - type = descriptor.defaultType.toBound(), - underlyingType = descriptor.underlyingType.toBound(), - documentation = descriptor.resolveDescriptorData(platformData), - platformData = listOf(platformData) - ) + with(descriptor) { + DTypeAlias( + dri = DRI.from(this), + name = name.asString(), + type = defaultType.toBound(), + underlyingType = PlatformDependent.from(platformData, underlyingType.toBound()), + visibility = if (isExpect) PlatformDependent.expectFrom(visibility.toDokkaVisibility()) + else PlatformDependent.from(platformData, visibility.toDokkaVisibility()), + documentation = resolveDescriptorData(platformData), + platformData = listOf(platformData) + ) + } private fun parameter(index: Int, descriptor: ValueParameterDescriptor, parent: DRIWithPlatformInfo) = DParameter( diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index 5ed44e18..3fcd07b3 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -72,14 +72,16 @@ open class DefaultPageCreator( } protected open fun contentForPackage(p: DPackage) = contentBuilder.contentFor(p) { - group(p.dri, p.platformData.toSet(), ContentKind.Packages){ + group(p.dri, p.platformData.toSet(), ContentKind.Packages) { header(1) { text("Package ${p.name}") } } +contentForScope(p, p.dri, p.platformData) - block("Type aliases", 2, ContentKind.Classlikes, p.typealiases, p.platformData.toSet()) { + block("Type aliases", 2, ContentKind.TypeAliases, p.typealiases, p.platformData.toSet()) { link(it.name, it.dri) group { - +buildSignature(it) + platformDependentHint(it.dri, it.platformData.toSet()) { + +buildSignature(it) + } group(kind = ContentKind.BriefComment) { text(it.briefDocumentation()) } @@ -147,7 +149,7 @@ open class DefaultPageCreator( } protected open fun contentForClasslike(c: DClasslike) = contentBuilder.contentFor(c) { - group(c.dri, c.platformData.toSet(), ContentKind.Classlikes){ + group(c.dri, c.platformData.toSet(), ContentKind.Classlikes) { header(1) { text(c.name.orEmpty()) } platformDependentHint(c.dri, c.platformData.toSet()) { +buildSignature(c) @@ -179,7 +181,7 @@ open class DefaultPageCreator( block("Entries", 2, ContentKind.Classlikes, c.entries, c.platformData.toSet()) { link(it.name.orEmpty(), it.dri) group { - platformDependentHint(it.dri, it.platformData.toSet()){ + platformDependentHint(it.dri, it.platformData.toSet()) { +buildSignature(it) } group(kind = ContentKind.BriefComment) { @@ -193,12 +195,12 @@ open class DefaultPageCreator( } @Suppress("UNCHECKED_CAST") - private inline fun <reified T: TagWrapper> GroupedTags.withTypeUnnamed(): PlatformDependent<T> = + private inline fun <reified T : TagWrapper> GroupedTags.withTypeUnnamed(): PlatformDependent<T> = (this[T::class] as List<Pair<PlatformData, T>>?) ?.let { PlatformDependent.from(it) }.orEmpty() @Suppress("UNCHECKED_CAST") - private inline fun <reified T: NamedTagWrapper> GroupedTags.withTypeNamed(): Map<String, PlatformDependent<T>> = + private inline fun <reified T : NamedTagWrapper> GroupedTags.withTypeNamed(): Map<String, PlatformDependent<T>> = (this[T::class] as List<Pair<PlatformData, T>>?) ?.groupBy { it.second.name } ?.mapValues { (_, v) -> PlatformDependent.from(v) } diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt index f77b4592..74d0011f 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt @@ -34,9 +34,10 @@ open class PageContentBuilder( kind: Kind = ContentKind.Main, styles: Set<Style> = emptySet(), extra: PropertyContainer<ContentNode> = PropertyContainer.empty(), + platformData: Set<PlatformData> = d.platformData.toSet(), block: DocumentableContentBuilder.() -> Unit = {} ): ContentGroup = - DocumentableContentBuilder(d.dri, d.platformData.toSet(), styles, extra) + DocumentableContentBuilder(d.dri, platformData, styles, extra) .apply(block) .build(d.platformData.toSet(), kind, styles, extra) |