aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvmishenev <vad-mishenev@yandex.ru>2021-11-14 17:30:45 +0300
committerGitHub <noreply@github.com>2021-11-14 17:30:45 +0300
commitb0ef7386623d6f01eec3352a552946923b5dd9d0 (patch)
treeff6f48d3b4178a3fed5104faaf8d9284928338e2
parent91b2fab43a9c052557e041dddbc1592d7d617538 (diff)
downloaddokka-b0ef7386623d6f01eec3352a552946923b5dd9d0.tar.gz
dokka-b0ef7386623d6f01eec3352a552946923b5dd9d0.tar.bz2
dokka-b0ef7386623d6f01eec3352a552946923b5dd9d0.zip
Fix order of platform bubbles in header (#2225)
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt28
1 files changed, 16 insertions, 12 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 910f06a7..91e49a13 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -120,19 +120,20 @@ open class HtmlRenderer(
if (shouldRenderSourceSetBubbles && page is ContentPage) {
div(classes = "filter-section") {
id = "filter-section"
- page.content.withDescendants().flatMap { it.sourceSets }.distinct().forEach {
- button(classes = "platform-tag platform-selector") {
- attributes["data-active"] = ""
- attributes["data-filter"] = it.sourceSetIDs.merged.toString()
- when (it.platform.key) {
- "common" -> classes = classes + "common-like"
- "native" -> classes = classes + "native-like"
- "jvm" -> classes = classes + "jvm-like"
- "js" -> classes = classes + "js-like"
+ page.content.withDescendants().flatMap { it.sourceSets }.distinct()
+ .sortedBy { it.comparableKey }.forEach {
+ button(classes = "platform-tag platform-selector") {
+ attributes["data-active"] = ""
+ attributes["data-filter"] = it.sourceSetIDs.merged.toString()
+ when (it.platform.key) {
+ "common" -> classes = classes + "common-like"
+ "native" -> classes = classes + "native-like"
+ "jvm" -> classes = classes + "jvm-like"
+ "js" -> classes = classes + "js-like"
+ }
+ text(it.name)
}
- text(it.name)
}
- }
}
}
}
@@ -223,7 +224,7 @@ open class HtmlRenderer(
+htmlContent
}
}
- }.sortedBy { it.first.sourceSetIDs.merged.let { it.scopeId + it.sourceSetName } }
+ }.sortedBy { it.first.comparableKey }
}
override fun FlowContent.buildDivergent(node: ContentDivergentGroup, pageContext: ContentPage) {
@@ -912,3 +913,6 @@ private fun PropertyContainer<ContentNode>.extraHtmlAttributes() = allOfType<Sim
private val ContentNode.sourceSetsFilters: String
get() = sourceSets.sourceSetIDs.joinToString(" ") { it.toString() }
+
+private val DisplaySourceSet.comparableKey
+ get() = sourceSetIDs.merged.let { it.scopeId + it.sourceSetName }