aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2022-08-17 16:27:51 +0200
committerGitHub <noreply@github.com>2022-08-17 16:27:51 +0200
commite9e95f6bdefa2ea4bd2cc1a79ed642ff57b25e48 (patch)
tree1325bf4191333282785ae200185b57dd0a2d6120 /plugins/base/src/main/kotlin/renderers
parentad1d48070d621b1feb5a0e8ceab90ed9367ac18b (diff)
downloaddokka-e9e95f6bdefa2ea4bd2cc1a79ed642ff57b25e48.tar.gz
dokka-e9e95f6bdefa2ea4bd2cc1a79ed642ff57b25e48.tar.bz2
dokka-e9e95f6bdefa2ea4bd2cc1a79ed642ff57b25e48.zip
Do not render platform tabs for common-only content (#2613)
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 55afef80..945fff38 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -3,6 +3,7 @@ package org.jetbrains.dokka.base.renderers.html
import kotlinx.html.*
import kotlinx.html.stream.createHTML
import org.jetbrains.dokka.DokkaSourceSetID
+import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.*
import org.jetbrains.dokka.base.renderers.html.command.consumers.ImmediateResolutionTagConsumer
@@ -201,12 +202,21 @@ open class HtmlRenderer(
shouldHaveTabs: Boolean = shouldRenderSourceSetBubbles
) {
val contents = contentsForSourceSetDependent(nodes, pageContext)
+ val isOnlyCommonContent = contents.singleOrNull()?.let { (sourceSet, _) ->
+ sourceSet.platform == Platform.common
+ && sourceSet.name.equals("common", ignoreCase = true)
+ && sourceSet.sourceSetIDs.all.all { sourceSetDependencyMap[it]?.isEmpty() == true }
+ } ?: false
- val divStyles = "platform-hinted ${styles.joinToString()}" + if (shouldHaveTabs) " with-platform-tabs" else ""
+ // little point in rendering a single "common" tab - it can be
+ // assumed that code without any tabs is common by default
+ val renderTabs = shouldHaveTabs && !isOnlyCommonContent
+
+ val divStyles = "platform-hinted ${styles.joinToString()}" + if (renderTabs) " with-platform-tabs" else ""
div(divStyles) {
attributes["data-platform-hinted"] = "data-platform-hinted"
extra.extraHtmlAttributes().forEach { attributes[it.extraKey] = it.extraValue }
- if (shouldHaveTabs) {
+ if (renderTabs) {
div("platform-bookmarks-row") {
attributes["data-toggle-list"] = "data-toggle-list"
contents.forEachIndexed { index, pair ->