aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt34
1 files changed, 22 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 85005bc0..c62c5d3c 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -52,6 +52,7 @@ open class HtmlRenderer(
nodes: Map<SourceSetData, Collection<ContentNode>>,
pageContext: ContentPage
) {
+ var mergedToOneSourceSet : SourceSetData? = null
div("platform-hinted") {
attributes["data-platform-hinted"] = "data-platform-hinted"
var counter = 0
@@ -94,11 +95,14 @@ open class HtmlRenderer(
}
}
}
+ } else if (nodes.size > 1) {
+ mergedToOneSourceSet = contents.first().first
}
contents.forEach {
consumer.onTagContentUnsafe { +it.second }
}
}
+ mergedToOneSourceSet?.let { createPlatformTagBubbles(listOf(it)) }
}
override fun FlowContent.buildDivergent(node: ContentDivergentGroup, pageContext: ContentPage) {
@@ -239,24 +243,30 @@ open class HtmlRenderer(
}
}
- private fun FlowContent.createPlatformTags(node: ContentNode, sourceSetRestriction: Set<SourceSetData>? = null) {
- node.takeIf { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } }?.let {
- div("platform-tags") {
- node.sourceSets.filter { sourceSetRestriction == null || it in sourceSetRestriction }.forEach { data ->
- div("platform-tag") {
- when(data.platform.key){
- "common" -> classes = classes + "common-like"
- "native" -> classes = classes + "native-like"
- "jvm" -> classes = classes + "jvm-like"
- "js" -> classes = classes + "js-like"
- }
- text(data.sourceSetName)
+ private fun FlowContent.createPlatformTagBubbles(sourceSets: List<SourceSetData>) {
+ div("platform-tags") {
+ sourceSets.forEach {
+ div("platform-tag") {
+ 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.sourceSetName)
}
}
}
}
+ private fun FlowContent.createPlatformTags(node: ContentNode, sourceSetRestriction: Set<SourceSetData>? = null) {
+ node.takeIf { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } }?.let {
+ createPlatformTagBubbles( node.sourceSets.filter {
+ sourceSetRestriction == null || it in sourceSetRestriction
+ })
+ }
+ }
+
override fun FlowContent.buildTable(
node: ContentTable,
pageContext: ContentPage,