From 68553bf4c1de2b640a376f0ac4755a6c5bc7dd79 Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Thu, 1 Oct 2020 08:38:31 +0200 Subject: Improve styles --- .../src/main/kotlin/renderers/html/HtmlRenderer.kt | 181 +++++++++++++++------ .../kotlin/signatures/KotlinSignatureProvider.kt | 2 +- .../documentables/DefaultPageCreator.kt | 34 ++-- .../documentables/PageContentBuilder.kt | 4 +- .../base/src/main/resources/dokka/styles/style.css | 87 ++++++---- .../kotlin/content/params/ContentForParamsTest.kt | 152 ++++++++--------- .../content/seealso/ContentForSeeAlsoTest.kt | 168 +++++++++---------- .../SkippingParenthesisForConstructorsTest.kt | 12 +- plugins/base/src/test/kotlin/enums/EnumsTest.kt | 10 +- .../kotlin/linkableContent/LinkableContentTest.kt | 2 +- .../test/kotlin/renderers/html/DivergentTest.kt | 8 +- .../kotlin/signatures/DivergentSignatureTest.kt | 14 +- 12 files changed, 384 insertions(+), 290 deletions(-) (limited to 'plugins/base/src') diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 7a047d3c..abb4e85b 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -22,7 +22,6 @@ import org.jetbrains.dokka.plugability.query import org.jetbrains.dokka.plugability.querySingle import org.jetbrains.dokka.utilities.htmlEscape import org.jetbrains.dokka.utilities.urlEncoded -import java.io.File import java.net.URI open class HtmlRenderer( @@ -278,12 +277,8 @@ open class HtmlRenderer( val content = contentsForSourceSetDependent(divergentForPlatformDependent, pageContext) consumer.onTagContentUnsafe { - +createHTML().div("brief-with-platform-tags") { - consumer.onTagContentUnsafe { - +createHTML().div("inner-brief-with-platform-tags") { - consumer.onTagContentUnsafe { +it.key.first } - } - } + +createHTML().div("with-platform-tags") { + consumer.onTagContentUnsafe { +it.key.first } consumer.onTagContentUnsafe { +createHTML().span("pull-right") { @@ -296,7 +291,7 @@ open class HtmlRenderer( } } } - div("main-subrow") { + div { if (node.implicitlySourceSetHinted) { buildPlatformDependent(divergentForPlatformDependent, pageContext) } else { @@ -366,64 +361,141 @@ open class HtmlRenderer( .filter { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } } .takeIf { it.isNotEmpty() } ?.let { - val anchorName = node.dci.dri.first().anchor - withAnchor(anchorName) { - div(classes = "table-row") { - if (!style.contains(MultimoduleTable)) { - attributes["data-filterable-current"] = node.sourceSets.joinToString(" ") { - it.sourceSetIDs.merged.toString() - } - attributes["data-filterable-set"] = node.sourceSets.joinToString(" ") { - it.sourceSetIDs.merged.toString() - } - } + when (pageContext) { + is MultimoduleRootPage -> buildRowForMultiModule(node, it, pageContext, sourceSetRestriction, style) + is ModulePage -> buildRowForModule(node, it, pageContext, sourceSetRestriction, style) + else -> buildRowForContent(node, it, pageContext, sourceSetRestriction, style) + } + } + } - it.filterIsInstance().takeIf { it.isNotEmpty() }?.let { - div("main-subrow " + node.style.joinToString(" ")) { - it.filter { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } } - .forEach { - span { - it.build(this, pageContext, sourceSetRestriction) - buildAnchor(anchorName) - } - if (ContentKind.shouldBePlatformTagged(node.dci.kind) && (node.sourceSets.size == 1 || pageContext is ModulePage)) - createPlatformTags(node) - } + private fun FlowContent.buildRowForMultiModule( + contextNode: ContentGroup, + toRender: List, + pageContext: ContentPage, + sourceSetRestriction: Set?, + style: Set