aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt27
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt2
2 files changed, 10 insertions, 19 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index 9a88de86..26560e4f 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -211,29 +211,20 @@ open class HtmlRenderer(
): List<Pair<DisplaySourceSet, String>> {
var counter = 0
return nodes.toList().map { (sourceSet, elements) ->
- sourceSet to createHTML(prettyPrint = false).prepareForTemplates().div {
+ val htmlContent = createHTML(prettyPrint = false).prepareForTemplates().div {
elements.forEach {
buildContentNode(it, pageContext, sourceSet.toSet())
}
}.stripDiv()
- }.groupBy(
- Pair<DisplaySourceSet, String>::second,
- Pair<DisplaySourceSet, String>::first
- ).entries.flatMap { (html, sourceSets) ->
- sourceSets.filterNot { sourceSet ->
- sourceSet.sourceSetIDs.all.flatMap { sourceSetDependencyMap[it].orEmpty() }
- .any { sourceSetId -> sourceSetId in sourceSets.sourceSetIDs }
- }.map {
- it to createHTML(prettyPrint = false).prepareForTemplates()
- .div(classes = "content sourceset-depenent-content") {
- if (counter++ == 0) attributes["data-active"] = ""
- attributes["data-togglable"] = it.sourceSetIDs.merged.toString()
- unsafe {
- +html
- }
+ sourceSet to createHTML(prettyPrint = false).prepareForTemplates()
+ .div(classes = "content sourceset-depenent-content") {
+ if (counter++ == 0) attributes["data-active"] = ""
+ attributes["data-togglable"] = sourceSet.sourceSetIDs.merged.toString()
+ unsafe {
+ +htmlContent
}
- }
- }
+ }
+ }.sortedBy { it.first.sourceSetIDs.merged.let { it.scopeId + it.sourceSetName } }
}
override fun FlowContent.buildDivergent(node: ContentDivergentGroup, pageContext: ContentPage) {
diff --git a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
index 8c78eff7..4592f6e6 100644
--- a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt
@@ -126,7 +126,7 @@ class DivergentTest : HtmlRenderingOnlyTestBase() {
}
HtmlRenderer(context).render(page)
- renderedContent.match(Div(Div(Div(Div("ae"), Div("bd"), Div("c")))))
+ renderedContent.match(Div(Div(Div(Div("bd"), Div("c"), Div("ae")))))
}
@Test