From 199b69db4c1cb2cd90a2a190479082150235faf4 Mon Sep 17 00:00:00 2001 From: Szymon Świstun Date: Wed, 12 Feb 2020 11:20:58 +0100 Subject: rename --- .../main/kotlin/plugability/DefaultExtensions.kt | 1 - .../pages/SameMethodNamePageMergerStrategy.kt | 33 ++++++++++++++++++++++ .../pages/SameNamePageMergerStrategy.kt | 33 ---------------------- 3 files changed, 33 insertions(+), 34 deletions(-) create mode 100644 core/src/main/kotlin/transformers/pages/SameMethodNamePageMergerStrategy.kt delete mode 100644 core/src/main/kotlin/transformers/pages/SameNamePageMergerStrategy.kt (limited to 'core/src/main/kotlin') diff --git a/core/src/main/kotlin/plugability/DefaultExtensions.kt b/core/src/main/kotlin/plugability/DefaultExtensions.kt index 28753cc6..1320c282 100644 --- a/core/src/main/kotlin/plugability/DefaultExtensions.kt +++ b/core/src/main/kotlin/plugability/DefaultExtensions.kt @@ -10,7 +10,6 @@ import org.jetbrains.dokka.transformers.descriptors.DefaultDescriptorToDocumenta import org.jetbrains.dokka.transformers.documentation.DefaultDocumentationNodeMerger import org.jetbrains.dokka.transformers.documentation.DefaultDocumentationToPageTranslator import org.jetbrains.dokka.transformers.pages.DefaultPageMergerStrategy -import org.jetbrains.dokka.transformers.pages.SameNamePageMergerStrategy import org.jetbrains.dokka.transformers.psi.DefaultPsiToDocumentationTranslator import org.jetbrains.dokka.transformers.pages.DefaultPageNodeMerger diff --git a/core/src/main/kotlin/transformers/pages/SameMethodNamePageMergerStrategy.kt b/core/src/main/kotlin/transformers/pages/SameMethodNamePageMergerStrategy.kt new file mode 100644 index 00000000..3835506b --- /dev/null +++ b/core/src/main/kotlin/transformers/pages/SameMethodNamePageMergerStrategy.kt @@ -0,0 +1,33 @@ +package org.jetbrains.dokka.transformers.pages + +import org.jetbrains.dokka.pages.* + +object SameMethodNamePageMergerStrategy : PageMergerStrategy { + override fun tryMerge(pages: List): List { + val name = pages.first().name + val members = pages.filterIsInstance() + val others = pages.filterNot { it is MemberPageNode } + + val resChildren = members.flatMap { it.children }.distinct() + val dri = members.flatMap { it.dri }.toSet() + val dci = DCI( + dri = dri, + kind = members.first().content.dci.kind + ) + + 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): ContentGroup { + val n = nodes.first() + return ContentGroup(nodes, dci, n.platforms, n.style, n.extras) + } +} \ No newline at end of file diff --git a/core/src/main/kotlin/transformers/pages/SameNamePageMergerStrategy.kt b/core/src/main/kotlin/transformers/pages/SameNamePageMergerStrategy.kt deleted file mode 100644 index 47d5a2f5..00000000 --- a/core/src/main/kotlin/transformers/pages/SameNamePageMergerStrategy.kt +++ /dev/null @@ -1,33 +0,0 @@ -package org.jetbrains.dokka.transformers.pages - -import org.jetbrains.dokka.pages.* - -object SameNamePageMergerStrategy : PageMergerStrategy { - override fun tryMerge(pages: List): List { - val name = pages.first().name - val members = pages.filterIsInstance() - val others = pages.filterNot { it is MemberPageNode } - - val resChildren = members.flatMap { it.children }.distinct() - val dri = members.flatMap { it.dri }.toSet() - val dci = DCI( - dri = dri, - kind = members.first().content.dci.kind - ) - - 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): ContentGroup { - val n = nodes.first() - return ContentGroup(nodes, dci, n.platforms, n.style, n.extras) - } -} \ No newline at end of file -- cgit