aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin
diff options
context:
space:
mode:
authorSzymon Świstun <sswistun@virtuslab.com>2020-02-12 11:11:04 +0100
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-02-12 13:33:10 +0100
commit346a6b9091167771694508b77bf123d919347e6c (patch)
tree9b6c66558e1f6ac2bfd415d1233b64bb7b7c99c1 /core/src/main/kotlin
parent519bc7969930f191fb7d9155b1c07f7e226e219f (diff)
downloaddokka-346a6b9091167771694508b77bf123d919347e6c.tar.gz
dokka-346a6b9091167771694508b77bf123d919347e6c.tar.bz2
dokka-346a6b9091167771694508b77bf123d919347e6c.zip
corrected SameName strategy
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r--core/src/main/kotlin/transformers/pages/SameNamePageMergerStrategy.kt31
1 files changed, 17 insertions, 14 deletions
diff --git a/core/src/main/kotlin/transformers/pages/SameNamePageMergerStrategy.kt b/core/src/main/kotlin/transformers/pages/SameNamePageMergerStrategy.kt
index 5b0e8794..47d5a2f5 100644
--- a/core/src/main/kotlin/transformers/pages/SameNamePageMergerStrategy.kt
+++ b/core/src/main/kotlin/transformers/pages/SameNamePageMergerStrategy.kt
@@ -3,24 +3,27 @@ package org.jetbrains.dokka.transformers.pages
import org.jetbrains.dokka.pages.*
object SameNamePageMergerStrategy : PageMergerStrategy {
- override fun tryMerge(pages: List<PageNode>): List<PageNode> = listOf(pages.mergePageNodes())
+ override fun tryMerge(pages: List<PageNode>): List<PageNode> {
+ val name = pages.first().name
+ val members = pages.filterIsInstance<MemberPageNode>()
+ val others = pages.filterNot { it is MemberPageNode }
- private fun List<PageNode>.mergePageNodes(): ContentPage {
- val name = first().name
- val resChildren = this.flatMap { it.children }.distinct()
- val contentChildren = this.filterIsInstance<ContentPage>()
- val dri = contentChildren.flatMap { it.dri }.toSet()
+ val resChildren = members.flatMap { it.children }.distinct()
+ val dri = members.flatMap { it.dri }.toSet()
val dci = DCI(
dri = dri,
- kind = contentChildren.first().content.dci.kind
+ kind = members.first().content.dci.kind
)
- return contentChildren.first()
- .modified(
- dri = dri,
- name = name,
- children = resChildren,
- content = asGroup(dci, contentChildren.map { it.content })
- )
+
+ val merged = MemberPageNode(
+ dri = dri,
+ name = name,
+ children = resChildren,
+ content = asGroup(dci, members.map { it.content }),
+ documentable = null
+ )
+
+ return others + listOf(merged)
}
fun asGroup(dci: DCI, nodes: List<ContentNode>): ContentGroup {