aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt19
1 files changed, 16 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt
index b12075fb..3b2b2897 100644
--- a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt
+++ b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt
@@ -159,7 +159,9 @@ open class KotlinWebsiteHtmlOutputBuilder(
val platformToVersion = calculatePlatforms(platforms).platformToVersion
div(to, "tags") {
div(to, "spacer") {}
- platformToVersion.entries.forEach { (platform, version) ->
+ platformToVersion.entries.sortedBy {
+ platformSortWeight(it.key)
+ }.forEach { (platform, version) ->
div(to, "tags__tag platform tag-value-$platform",
otherAttributes = " data-tag-version=\"$version\"") {
to.append(platform)
@@ -184,8 +186,11 @@ open class KotlinWebsiteHtmlOutputBuilder(
override fun appendPlatformsAsText(platforms: PlatformsData) {
appendHeader(5) {
- to.append("For ")
- platforms.keys.filterNot { it.isJREVersion() }.joinTo(to)
+ val filtered = platforms.keys.filterNot { it.isJREVersion() }.sortedBy { platformSortWeight(it) }
+ if (filtered.isNotEmpty()) {
+ to.append("For ")
+ filtered.joinTo(to)
+ }
}
}
@@ -225,6 +230,14 @@ open class KotlinWebsiteHtmlOutputBuilder(
block(platforms)
}
}
+
+ fun platformSortWeight(name: String) = when(name.toLowerCase()) {
+ "common" -> 0
+ "jvm" -> 1
+ "js" -> 3
+ "native" -> 4
+ else -> 2 // This is hack to support JRE/JUnit and so on
+ }
}
class KotlinWebsiteHtmlFormatService @Inject constructor(