diff options
Diffstat (limited to 'plugins/base/src')
3 files changed, 53 insertions, 46 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 4f0c1e55..c061cabf 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -128,22 +128,32 @@ open class HtmlRenderer( ?.let { div(classes = "table-row") { it.filter { it.dci.kind != ContentKind.Symbol }.takeIf { it.isNotEmpty() }?.let { - div("main-subrow") { + div("main-subrow ${node.style.joinToString { it.toString().decapitalize() }}") { it.filter { platformRestriction == null || platformRestriction in it.platforms } .forEach { when(it.dci.kind){ - ContentKind.Main -> div("title") { - it.build(this, pageContext, platformRestriction) + ContentKind.PlatformDependantHint -> { + div("platform-dependant-row keyValue"){ + div() + div("title"){ + it.build(this, pageContext, platformRestriction) + } + } } - ContentKind.BriefComment, ContentKind.Comment -> div("brief") { - it.build(this, pageContext, platformRestriction) + ContentKind.Main -> { + div("title-row"){ + it.build(this, pageContext, platformRestriction) + div() + if (ContentKind.shouldBePlatformTagged(node.dci.kind) && node.platforms.size == 1) { + createPlatformTags(node) + } else { + div() + } + } } else -> div { it.build(this, pageContext, platformRestriction) } } } - if (ContentKind.shouldBePlatformTagged(node.dci.kind) && node.platforms.size == 1) { - createPlatformTags(node) - } } } it.filter { it.dci.kind == ContentKind.Symbol }.takeIf { it.isNotEmpty() }?.let { diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index 30ec38bb..313973bf 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -31,7 +31,9 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog ) } - private fun signature(e: DEnumEntry) = contentBuilder.contentFor(e, ContentKind.Symbol, setOf(TextStyle.Monospace)) + private fun signature(e: DEnumEntry) = contentBuilder.contentFor(e, ContentKind.Symbol, setOf(TextStyle.Monospace)){ + link(e.name, e.dri) + } private fun actualTypealiasedSignature(dri: DRI, name: String, aliasedTypes: PlatformDependent<Bound>) = aliasedTypes.entries.groupBy({ it.value }, { it.key }).map { (bound, platforms) -> diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index 9c7abdd9..439da560 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -83,11 +83,9 @@ open class DefaultPageCreator( +contentForScope(p, p.dri, p.platformData) block("Type aliases", 2, ContentKind.TypeAliases, p.typealiases, p.platformData.toSet()) { link(it.name, it.dri, kind = ContentKind.Main) - platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.Symbol) { + platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) { +buildSignature(it) - } - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) + contentForBrief(it) } } } @@ -99,29 +97,24 @@ open class DefaultPageCreator( ) = contentBuilder.contentFor(s as Documentable) { block("Types", 2, ContentKind.Classlikes, s.classlikes, platformData.toSet()) { link(it.name ?: "", it.dri, kind = ContentKind.Main) - platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.Symbol) { + platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) { +buildSignature(it) - } - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) + contentForBrief(it) } } block("Functions", 2, ContentKind.Functions, s.functions, platformData.toSet()) { link(it.name, it.dri, kind = ContentKind.Main) - platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.Symbol) { + platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) { +buildSignature(it) - } - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) + contentForBrief(it) } } block("Properties", 2, ContentKind.Properties, s.properties, platformData.toSet()) { link(it.name, it.dri, kind = ContentKind.Main) - platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.Symbol) { + platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) { +buildSignature(it) - } - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) + + contentForBrief(it) } } s.safeAs<WithExtraProperties<Documentable>>()?.let { it.extra[InheritorsInfo] }?.let { inheritors -> @@ -174,19 +167,18 @@ open class DefaultPageCreator( c.platformData.toSet() ) { link(it.name, it.dri, kind = ContentKind.Main) - platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.Symbol) { + platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) { +buildSignature(it) - } - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) + contentForBrief(it) } } } if (c is DEnum) { block("Entries", 2, ContentKind.Classlikes, c.entries, c.platformData.toSet()) { link(it.name, it.dri, kind = ContentKind.Main) - group(kind = ContentKind.BriefComment) { - text(it.briefDocumentation()) + platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) { + +buildSignature(it) + contentForBrief(it) } } } @@ -241,7 +233,7 @@ open class DefaultPageCreator( table(kind = ContentKind.Parameters) { platforms.flatMap { platform -> val receiverRow = receiver.getOrExpect(platform)?.let { - buildGroup(platformData = setOf(platform)) { + buildGroup(platformData = setOf(platform), kind = ContentKind.Parameters, styles = mainStyles + ContentStyle.KeyValue) { text("<receiver>") comment(it.root) } @@ -249,8 +241,8 @@ open class DefaultPageCreator( val paramRows = params.mapNotNull { (_, param) -> param.getOrExpect(platform)?.let { - buildGroup(platformData = setOf(platform)) { - text(it.name) + buildGroup(platformData = setOf(platform), kind = ContentKind.Parameters, styles = mainStyles + ContentStyle.KeyValue) { + text(it.name, kind = ContentKind.Parameters) comment(it.root) } } @@ -272,9 +264,9 @@ open class DefaultPageCreator( platforms.flatMap { platform -> seeAlsoTags.mapNotNull { (_, see) -> see.getOrExpect(platform)?.let { - buildGroup(platformData = setOf(platform)) { - if (it.address != null) link(it.name, it.address!!) - else text(it.name) + buildGroup(platformData = setOf(platform), kind = ContentKind.Comment, styles = mainStyles + ContentStyle.KeyValue) { + if (it.address != null) link(it.name, it.address!!, kind = ContentKind.Comment) + else text(it.name, kind = ContentKind.Comment) comment(it.root) } } @@ -331,6 +323,18 @@ open class DefaultPageCreator( }.children } + protected open fun DocumentableContentBuilder.contentForBrief(content: Documentable) { + content.platformData.forEach { platform -> + val root = content.documentation[platform]?.children?.firstOrNull()?.root + + root?.let { + group(platformData = setOf(platform), kind = ContentKind.BriefComment) { + text(it.docTagSummary(), kind = ContentKind.Comment) + } + } + } + } + protected open fun contentForFunction(f: DFunction) = contentBuilder.contentFor(f) { group(kind = ContentKind.Cover) { header(1) { text(f.name) } @@ -350,13 +354,4 @@ open class DefaultPageCreator( } protected open fun TagWrapper.toHeaderString() = this.javaClass.toGenericString().split('.').last() - - //TODO: It isn't platform-aware and produces wrong docs Probably should use platformDependentHint - protected open fun Documentable.briefDocumentation() = " " -// documentation.values -// .firstOrNull() -// ?.children -// ?.firstOrNull() -// ?.root -// ?.docTagSummary() ?: "" } |