From 356be7009f857032f87bf0e5943cdef7f1438f65 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Wed, 11 Mar 2020 13:56:21 +0100 Subject: Refactor brief documentation, remove `Parameters` block from functions' pages --- .../documentables/DefaultPageCreator.kt | 47 +++++++++++++++------- 1 file changed, 32 insertions(+), 15 deletions(-) (limited to 'plugins/base/src/main/kotlin/translators/documentables') diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index 3fc9592a..b92c058a 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -4,8 +4,6 @@ import org.jetbrains.dokka.base.signatures.SignatureProvider import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.* -import org.jetbrains.dokka.model.Annotation -import org.jetbrains.dokka.model.Enum import org.jetbrains.dokka.model.Function import org.jetbrains.dokka.model.doc.TagWrapper import org.jetbrains.dokka.pages.* @@ -45,8 +43,8 @@ open class DefaultPageCreator( block("Packages", 2, ContentKind.Packages, m.packages, m.platformData.toSet()) { link(it.name, it.dri) } - text("Index\n") - text("Link to allpage here") +// text("Index\n") TODO +// text("Link to allpage here") } protected open fun contentForPackage(p: Package) = contentBuilder.contentFor(p) { @@ -61,17 +59,28 @@ open class DefaultPageCreator( ) = contentBuilder.contentFor(s as Documentable) { block("Types", 2, ContentKind.Classlikes, s.classlikes, platformData.toSet()) { link(it.name.orEmpty(), it.dri) - +buildSignature(it) - text(it.briefDocTagString) + group { + +buildSignature(it) + group(kind = ContentKind.BriefComment) { + text(it.briefDocumentation()) + } + } } block("Functions", 2, ContentKind.Functions, s.functions, platformData.toSet()) { link(it.name, it.dri) - +buildSignature(it) - text(it.briefDocTagString) + group { + +buildSignature(it) + group(kind = ContentKind.BriefComment) { + text(it.briefDocumentation()) + } + } } block("Properties", 2, ContentKind.Properties, s.properties, platformData.toSet()) { link(it.name, it.dri) - text(it.briefDocTagString) + group(kind = ContentKind.BriefComment) { + text(it.briefDocumentation()) + } + } } @@ -83,8 +92,12 @@ open class DefaultPageCreator( if (c is WithConstructors) { block("Constructors", 2, ContentKind.Constructors, c.constructors, c.platformData.toSet()) { link(it.name, it.dri) - +buildSignature(it) - text(it.briefDocTagString) + group { + +buildSignature(it) + group(kind = ContentKind.BriefComment) { + text(it.briefDocumentation()) + } + } } } @@ -109,11 +122,15 @@ open class DefaultPageCreator( header(1) { text(f.name) } +buildSignature(f) +contentForComments(f) - block("Parameters", 2, ContentKind.Parameters, f.children, f.platformData.toSet()) { - text(it.name ?: "") - it.documentation.forEach { it.value.children.forEach { comment(it.root) } } - } } protected open fun TagWrapper.toHeaderString() = this.javaClass.toGenericString().split('.').last() + + protected open fun Documentable.briefDocumentation() = + documentation.values + .firstOrNull() + ?.children + ?.firstOrNull() + ?.root + ?.docTagSummary() ?: "" } \ No newline at end of file -- cgit